Useful Windows Commands

The following works for Windows 8

Windows Sysinternals process explorer.  Much more detailed than the task manager.

https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Display path and system variable:

In Windows Command-Prompt the syntax is echo %PATH%

To get a list of all environment variables enter the command set

To send those variables to a text file enter the command set > filename.txt

Equivalent of UNIX diff

fc file1 file2, binary: fc /B file1 file2

Equivalent of UNIX grep

findstr

helpful link: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/findstr.mspx?mfr=true

examples:

case insensitive (default is case sensitive)

findstr /i array *.php

Uses specified text as a literal search string (default multiple search tokens are separated by space even if they are within quotes)

findstr /c:”hello world” *.txt

Search subdirectories and case insensitive

findstr /Si “hello” *.txt

Mount Network Drive

In Command Prompt, type net use x:\\computer name\share name where x: is the drive letter you want to assign to the shard resource.

To disconnect, type net use x:/delete

note:  may need admin privilege.

Tell IP Address

In Command Prompt, type ipconfig.  The IP address of your computer is listed under IPv4.

Start Chrome from Command Line

start chrome http://localhost/whatever.html

Sort Directory by Date Output to File

dir /o-d >tmp.txt (latest on top)

dir /o >tmp.txt (oldest on top)

 

Zip files

Get all files needed into a directory, go to file explorer, click on share then choose zip

Directory name only redirect to file

dir /b >something.bat

Find a file name fish in all subdirectories

dir fish* /b/s

 

Schedule an auto reboot (Windows 8)

https://askleo.com/how-do-i-schedule-a-nightly-reboot-in-windows-8-1/

Get Creation date time stamp of a file

wmic datafile where name="c:\\somewhere\\log.txt" get creationdate

The returned timestamp has the format of yyyymmddHHMMSS.mmmmmmsUUU

Advance User Accounts Control Panel

Type netplwiz in the run command.

Tasklist command line piped to a file

tasklist > filename

Run program in the background (equivalent to UNIX &)

START /B program or START /B “” program – some versions of windows require a title line

Display A File

type filename (equivalent to cat in Unix)