Thursday, October 20, 2016

Command prompt some useful tricks

Send Command output to a new file

ipconfig > C:\Ipaddress.txt
this will create a text file named Ipaddress and the result will be saved in the file.


Send output to an existing file 

net use >> C:\Ipaddress.txt
this will append the result to the file Ipaddress


send output to clip board

ipconfig | clip
this will send the result of the command to clip board and you can use it later.








if you want to navigate to a folder which is deep in a folder tree from command prompt you have to use the cd command a number of times and is very annoying process. You can simply navigate to the folder through file explorer by and right click on the folder by holding the Shift key







it will open command prompt with that folder as current directory


You can use Tab button to auto fill file/folder name after a command. This will be helpful for longer filenames which might have so many numbers and all.
for example if you want to copy the following file MsftWdf_User_01_11_00_Inbox_Critical.Wdf; it will be quite difficult to type in that name correctly. you can just type copy after a blank space you can press tab continuously until this file shows up. or to filter out files you can enter few first characters of the file name and press Tab that will display only files which starts with that characters. In this example you can type(without quotes) "copy msf" then press Tab.



You can use up arrow key to use previous commands in command prompt. But if you are trying to find a particular command which you entered before 20 commands then it is a problem. You can view previous commands by using this command
doskey /history


you can drag a file/folder to command prompt, and the file/folder path will append with the current command. if you want to change directory to a long path just type cd and a blank space and drag the folder to command prompt.



You can run multiple commands in one line. use double ampersand to link commands
net use && ipconfig