Friday, 31 August 2012

Basic Windows Commands That You Should Know

Basic Windows Commands That You Should Know


So in this section we will discus some of the most used basic commands of windows and frequently used switches with them. Now why the hell in world of Graphical User Interface (GUI) of windows I need to learn windows commands? Answer is, no matter how much cool the GUI appears, the most powerful feature of any OS till today is its shell when comes to control,I may hardly get any to disagree on this and shell is handled with the help of shell interpreter/emulator better known as command line in common, command prompt in windows and terminal/konsole/tsch/zch etc in Linux depending on shell emulator. As a hacker you must be able to master most of the commands and their most commonly used switches. So get ready to have a look on them,

attrib: (attributes) is used to set attributes of a file or folder.
Syntax: attrib filename/foldername
most commonly used switches includes: +h -h,+r -r,+s -s, /s /d
where 'h' means Hide attribute, 'r' means read,' s' means system,
'/s' means apply to files in folder and “/d” means apply to folders inside
'+' means apply attributes, '–' means remove attributes
Example: attrib +h +r +s /s /d c:\max
this will apply hidden, read only and system file attributes to all files and folders of folder max


cd/chdir: (change directory) is used to change directory.
Syntax: cd option
where option may include full path of folder where you want to jump.
Example: “cd d:\demo” will take you to demo folder in d drive in spite of where you are at present.
Cd .. go one step back.
Cd\ return to main drive.

Compact: Used to compress contents of folder without zipping or archiving them.
Syntax: compact options foldername
Options are 'c' means compress, 'u' means uncompress 'f' force compression
Example: This command is mostly used link this
compact /c /f folder_name
compact /u /f foldr_name

Copy: Used to copy files(not folder)
Syntax: copy /option source_file destination
Options can be left blank and mostly left blank. Most used switches includes 'a' which means ASCII file and 'b' which means binary file.
Example: copy c:\robot.txt d:\ this will copy robot.txt file from c to d drive.


Mkdir: used to crease folder
Syntax: mkdir drive\foldername or mkdir foldername
Example: mkdir max
mkdir a\b\c\v
Rename: used to rename file
Syntax: rename file1 file2
Example:rename max.txt dave.txt
this will rename max.txt to dave.txt

RD\Rmdir:(remove directory) Used to remove directory
Syntax: rmdir directory_name
Example: rmdir max
This will remove directory named max.

Other commands:
Date: Displays ans sets date.
Time:Displays and sets time.
Tasklist: Shows running processes

Taskkill: Used to kill a process rather than going in switch detail I 'll directly show you syntax to kill a process but first get process ID by executing Tasklist.
Syntax: taskkill /PID process_id /f
Example: taskkill /PID 1234 /f



Now so far as I think no one can remember all those switches so better try to use “command /?” this will open help pages for command. Note that we haven't yet covered all commands we just took an overlook over most basic windows commands, with time we'll move ahead and learn some really complicated commands and their switches. Till then I recommend you to try to run and execute all these commands and also try to find out other switches used while using commands by post-fixing commands with /? Commands like “set” and “net” may themselves need two to three posts like this so its better to cover them when need arrives. Till then if you have problem executing any of above commands feel free to ask.

No comments:

Post a Comment