Windows Console (cmd) Tips

  • Gérald Barré

As a developer or an administrator, you often use the Windows Console. Before Windows 10 and Windows Server 2016, it was a pain. The main burden was the 80-column limitation. But Microsoft has finally decided to make some improvements. The major improvement is the console now supports more than 80 columns and common shortcuts such as Ctrl+C and Ctrl+V. Here are some tips to help you use the console.

#Quickly open a cmd from the explorer

You often want to open a console in a specific directory. Instead of using the cd command, you can open it from the explorer. Simply enter cmd in the search bar and press enter. You can focus the search bar by pressing CTRL+L.

Open Windows ConsoleOpen Windows Console

Of course, you can replace cmd by powershell, pwsh (PowerShell Core) or wt (Windows Terminal) 😉

#Change the transparency (Ctrl+Shift+Mouse wheel)

You can change the transparency of the console using Ctrl+Shift+Mouse wheel or Ctrl+Shift++ and Ctrl+Shift+-. This allows viewing the window behind which may contain useful info for writing commands.

#Full Screen (F11)

If you are only using the console, such as on Windows Server Core, you can show the console in full screen using F11 or Alt+Enter. This will make your Windows look like Linux 😃

Windows Console fullscreenWindows Console fullscreen

#Commands history on cmd (F7)

It's nice to avoid typing a command twice. The console keeps a history of all the executed commands, so you can reuse them later. Navigating using up and down is not so useful as you don't always know which is the previous command. The console has an awesome UI for showing previous commands 😃 You can show it using F7

Windows Console historyWindows Console history

#Commands history on PowerShell (F7)

PowerShell allows you to search previous commands using Ctrl+R. In addition to the search feature, you can use the PSReadLine module to autocomplete commands from the history.

Install-Module -Name PSReadLine -AllowClobber -Force
Set-PSReadLineOption -PredictionSource History

#Find text (Ctrl+F)

Sometimes you need to search in the output of a command. Of course, you can read the whole output and find what you are looking for. But, if the output is very long, you'll spend long minutes. As in many applications, you can find text using Ctrl+F.

Windows Console findWindows Console find

#Copy the output of a command to the clipboard

You can use the clip command to redirect the command output from the command line to the Windows clipboard:

echo toto | clip

You can also copy the content of a file to the clipboard:

clip < file.txt

#Pipe commands between Windows and Linux

dir | wsl grep ts
wsl ls | find /i "ts"

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub