10 Command Prompt Tricks You Should Try in Windows 11

5. Combining Two Commands in a Command Prompt

In Command Prompt, you can combine multiple commands into a single, more efficient line. This is known as “chaining” or command merging. This way, you can run multiple commands in a row without having to type them one by one.

One common way to combine commands is to use the &&& operator. Commands that use && ensure that the second command will only be executed if the first command succeeds.

For example, to see a list of drivers installed on the system and open the resulting file in Notepad, you can run the following command:

driverquery /FO list /v > driverlist.txt  &&  notepad.exe driverlist.txt

Command explanation:

  • driverquery /FO list /v: This command displays a list of drivers installed on your computer in list format with detailed information (option verbose).
  • > driverlist.txt: This section stores the results of driverquery commands into a text file named driverlist.txt.
  • &&: This operator is used to combine commands. The second command will only be executed if the first command succeeds.
  • notepad.exe driverlist.txt: This section opens a driverlist.txt file that was recently created with the Notepad app.

6. Button Function in Windows 11 Command Line

Function keys (F1 to F12) are helpful in Windows 11’s Command Line, improving efficiency when executing commands. Here is an explanation of the functions of the F1 to F9 keys:

  • F1: Repeat the last command, one character at a time.
  • F2: Enter the last command until the specified character.
  • F3: Repeat the last command in full.
  • F4: Delete the character in the last command until the specified character.
  • F5: Repeat the last command (without typing).
  • F6: Enter the Control-Z character (input end mark).
  • F7: View the history of commands that have been executed.
  • F8: Search for commands in the history by typed characters.
  • F9: Execution of a specific command from the history by number.

7. View Installed Apps

You can see all the apps installed on your Windows 11 with the following command:

wmic product get name

If the list of apps is too long to display in a command prompt window, you can switch the result to a text file and open it directly with Notepad. Use this command:

wmic product get name > productname.txt &&  notepad.exe productname.txt

Command Explanation:

  • wmic product get name: This command retrieves and displays the names of all the applications installed on the system.
  • >: This operator is used to redirect results to a file.
  • productname.txt: The name of the text file where the results will be saved.
  • &&  notepad.exe  productname.txt: Once the file is created, Notepad will automatically open to display the contents of the file.

8. Delete Temporary Files

If you’re short on storage space, it’s a good idea to clean the Temp folder used by Windows 11 to store temporary data. Here’s how to do it:

del /q /f /s %temp%\*

Command Explanation:

  • del: Command to delete the file.
  • /q: Executes the command without displaying a confirmation message for each deleted file.
  • /f: Forcing deletion of read-only files.
  • /s: Deletes files from all subfolders.
  • %temp%: A variable that points to the current user’s temporary folder.
  • *: Indicates that all files in the folder will be deleted.

Latest Articles