Skip to content

Windows CLI Basics

Win+R to open run box
type the application you want opened
EXPLORER – file explorer
CMD – command prompt
MMC – Microsoft Management Console
MSINFO32 – system info page
MSTSC – remote desktop
Notepad – notepad
Ctrl+Shift+Enter to open app as admin

CMD Commands

cls to clear the screen

exit closes cmd

help to get basic commands help
cmd /? to get specific command help

whoami to show the identity of the user of cmd

f7 to show past used commands
doskey /history to show past used commands

Other CMD Commands

gpresult displays Group Policy resultant set of properties for user and machine
/r summary
/s system to view the results

gpupdate update the GroupPolicy
/target:Computer force a computer to update
/force local to update
//reboot after it updates, reboot

net use how the network is being used
net user display and change info about a user

System Commands

dism Deployment Image Servicing and Management

sfc verifies and repairs Windows system files

shutdown shutdown whatever the modifier modifies
/s shutdown
/r restart
/h hibernate
/f force close without warning to user
/m <computerName> for remote killings

tasklist shows current running processes on machine

taskkill [/pid <ProcessID> | /im <ImageName>]
/pid which task to kill based on processID
/im which task to kill based on imagename
/f forcefully kill
/t kill any child too

Disk Commands

CHKDSK <vol> <path> <fileName> checks a disk and display a report
/f fixes errors with sectors and other things
/r repairs physical errors if possible

DISKPART Opens up its own cmd to allow you to:
create create a partition
extend extend the size of the partition
shrink shrink the size of the partition

format <vol> formats a disk for use with Windows
/q quick format – doesn’t check for errors
/v specific volume name/label
/fs specify filesystem

Folder Editing

cd [/d] [<driveName>] [path] shows the name of current dir or changes it
/d changes drive and dir
. current level of dir
.. go up a level
\ go to root

dir show directories and files under the dir
/a shows all files
/os sorts by file size
/b only shows file names and folder names
/w arranges files in columns (wide view)

md <folderName> [<folderPath>] makes a dir

move <folderName | folderName> <path | newFolderName>

rd <folderName> [<folderPath>] removes/deletes a dir

ren <oldFileName> <newFileName> renaming folders

File Editing

copy <sourceFile> [<destFile>]copies files to from location

del <names, names> deletes files from locations

echo “<somewords>” > <fileName>.txt

move <folderName | folderName> <path | newFolderName>

robocopy <source> <dest>robust file copying for Windows

type <fileName> displays contents of file

xcopy <source> <dest> copies files and dir trees (use robocopy instead)

Modifiers

cmd |more scroll through cmd page by page

*” wildcard to match any group of char
? wildcard to match a single char

text without brackets or braces type text exactly as shown
<text within these> input must be given
[text within brackets] input is optional
{text within braces} input is one and only one of these
| mutually excusive items
repeatable items

Leave a Reply

Your email address will not be published. Required fields are marked *