Windows Cheatsheet

Handy tips and commands for life on Windows (when you are used to UNIX).

Posted: Fri 13 Jan, 2017, 11:08

How to find processes with commmand line arguments

    WMIC path win32_process get Caption,ParentProcessId,Processid,Commandline | findstr <searchstr>
        

Then use Task Manager to End Process

To change directory (and drive)

    cd /d <drive:dir>
        

To redirect output to file

Just like UNIX...

    echo "Hello" >> c:\temp\proc.log 2>&1
        

To get pwd on Windows

    echo %cd%
        

To get the first argument passed to a bat file

    echo %1
        

UNIX which on Windows

    where <cmd>
        

Of course it had to be different.

Sleep for x seconds

    timeout 5
        

To sleep for 5 seconds

Line count

    netstat -a | find /c /i "TIME_WAIT"
        

To create a symbolic link on Windows do

    mklink /d current 0.2.03
        

The opposite way around to Linux i.e. the link name first followed by the directory that already exists.