≡ Menu

Windows 8 essential commands

System operation commands

Reboot computer

shutdown /r

Shutdown computer

shutdown /s

Abort a shutdown/reboot operation issued from cmd

shutdown /a

Hibernate computer

shutdown /h

Logoff from current session

logoff

Directory commands

Create a directory

mkdir directoryName

Delete a empty directory

rmdir directoryName

Delete directory and all its contents

rmdir /S directoryName

File commands

Copy a file to another directory

copy C:\folder\file1 D:\folder2\folder3\

Rename a file

ren C:\folder\filename1.docx   filename2.docx

Delete a file

del filename.doc

Set/Unset read-only/archive/system attributes for a file

attrib +R filename
attrib -A filename

Open a file from command prompt

filename.ext

Examples:
To open a text file run file.txt
To open a doc file file.docx

Print the contents of a text file in command window

type filename.txt

Print the last few lines of a text file

tail -n filename.txt

Print the contents of a file as it gets modified in parallel

tail filename.txt

The syntax of this command is exactly same as Linux tail command.

System information commands

Find IP address of the system

ipconfig

Get system hardware/software information

systeminfo

Search for pattern in files

To search for all occurrences of specific text in a file

findstr /C:"pattern to be searched for" fileName

Search for the pattern in all files of current directory

findstr /C:"pattern to be searched for" *

Example: To search for string 1234 in all the text files in current directory

findstr /C:"1234" *.txt

Other commands:
Copy the output of a command so that you can paste it in another application

application.exe | clip

This command would copy the output generated by application.exe to clipboard. After this if you do ‘pater’ or Ctrl-V, the copied output will be pasted in the application.

{ 3 comments… add one }
  • U

    Whats new for Win 8?
    All have been there for a long time

  • Navid

    for running on a schedule or after some minutes you leave computer you can use “timeout /t 36000 /nobreak & rundll32.exe user32.dll,LockWorkStation” create a .bat file put it in schedule task,put the trigger run on idle. you can change /t xxx based on how much you need to wait. you can use this command for shutdown: timeout /t 36000 /nobreak & shutdown /h /f

  • no3gods

    @U
    The first few commands listed here are “essential” for Windows 8 because they (M$) has made it difficult to shutdown/logoff/restart the computer without having to go through many step. With win8.1, it is easier, but still not as easy as it used to be.

    With a batch command a user can create a batch file on their desktop that will do any of the those commands, i.e. shutdown, restart, logoff. :)

Leave a Comment