Best Command Prompt Tricks & Hacks for Windows
Guest Post by my Friend Abhishek…
This is an excellent post which can really make your life easier in the *NIX world. But, for many, it is a Windows kind of life. So, for those of you out there, I have put together some Windows command line tricks that might make your life easier.
Tip : Best Notepad Tricks : Amazing Notepad Tricks for Windows
15 Popular Command Prompt Tricks & Hacks
Save A List of Files to a Text File by Extension
dir *.ext /s /b > files.txt
This command line will create a file called files.txt. When you open this file, there will be a complete list of all the files in that directory and all subdirectories with the .ext extension. You can then open up this text file in any text editor and work this the information.By changing the ext part, you can select different files. For example, if you wanted to list all of the PDF documents, you would type:
dir *.pdf /s /b > files.txt
Get Your IP Address Information
ipconfig /all
This will retrieve a pile of information about your network connection and IP information. From this command, you can get:
- Host Name
- Primary DNS Suffix
- Node Type
- IP Routing Enabled
- WINS Proxy Enabled
- DNS Suffix Search List
- Connection-specific DNS Suffix
- Network Adapter Description
- Physical (MAC) Address
- DHCP Enabled
- IP Address
- Subnet Mask
- Default Gateway
- DNS Servers
Get Installed Driver Information
driverquery
It can be very useful when troubleshooting to know what drivers are installed on a system. This command will give you a complete listing of the drivers and when they were installed.
Copy Files Via Infrared Port
irftp filename.ext
This will fire up the Wireless Link dialog so that you can copy the specified file via an infrared port.
Find Files Opened By Network Users
openfiles /query
If you are running a system and you want to know who has files open on your computer, this command will provide you a list of those users and the files that they have open.
Note: If you get an error saying The system global flag ‘maintain objects list’ needs to be enabled to see local opened files, you can fix this issue by typing
openfiles /local on. You will have to reboot the system but it will resolve the issue.
Monitor Port Activity
netstat -a 30
This will show you all of the TCP/IP ports that are being used on your system and what they are connecting to (or being connected from). It will continue to monitor these ports and refresh the information every 30 seconds. You can change the refresh rate by changing the number at the end of the command.
Tip : Best Tips to Make Firefox 3+ Faster
Recover Information From A Corrupt File
recover filename.ext
If you have a disk with damaged sectors, you can attempt to recover as much information as possible from the damaged file. Data that is not damaged can be retrieved but data in damaged sectors will be lost.
Defragment Remote Computer
rexec remotePC defrag C: /F
This command used the rexec command to force a defragment of the C: drive on the computer named remotePC. You can use whatever you want to for the command (I just used defrag C: /F as an example). This is very useful for remote maintenance.
Retrieve Detailed System Information
systeminfo
With this command, you can retrieve the following information:
- Host Name
- OS Name
- OS Version
- OS Manufacturer
- OS Configuration
- OS Build Type
- Registered Owner
- Registered Organization
- Product ID
- Original Install Date
- System Up Time
- System Manufacturer
- System Model
- System type
- Processor(s)
- BIOS Version
- Windows Directory
- System Directory
- Boot Device
- System Locale
- Input Locale
- Time Zone
- Total Physical Memory
- Available Physical Memory
- Virtual Memory Max Size
- Virtual Memory Available
- Virtual Memory In Use
- Page File Location(s)
- Domain
- Logon Server
- Hotfix(s)
- NetWork Card(s)
Automatically Defragment C: Daily
schtasks /create /tn "Defrag C" /tr "defrag c: /f" /sc daily /st 23:00:00 /ru "System"
This will set your computer to automatically perform a complete defrag of the C: drive each day at 11:00:00 PM (23:00:00). It does this by creating a scheduled task called Defrag C. It will run this command under the computer’s system account.
Map A Drive Letter to a Folder
subst W: C:\windows
Sometimes, your directory structure can get pretty deep and complicated. You can simplify this a bit by mapping a drive letter to commonly used folders. In the example that I have given, this will create a drive letter W: and map it to the C:\windows directory. Then, whenever you go into My Computer, you will see a W: drive and when you browse to it, it will automatically take you to the contents of the C:\windows folder.
You can do this with any unused drive letter and any folder that exists on your system.
List All Tasks Running On The Computer
tasklist
It’s always good to know what is running on your system. This is the command line version of the processes tab in Taks Manager.
Kill A Program
taskkill /im programname.exe /f
If, when using the tasklist command, you discover that there is something running you just want killed. This is the way to do it! Just note the program name and use it in place of programname.exe.
Reboot a Remote Computer
shutdown -r -f -m \\remotePC -c "System will be rebooted in 20 seconds"
Sometimes, you just need to reboot a system. This will do it remotely and give the user a 20 second warning.
Tip : To open Command Prompt, click Start, click Run, type cmd, and then click OK.
Random : Optimize Google Search Results Using Feature Search & Hacks
Some More Command Prompt Tricks & Hacks – Video
Leave your Comments …
Also Read : Best Softwares to Move, Copy Files Faster in Windows
40 Responses »
Sourish Nath : Nice Post.Thanks for refreshing all lost memories. Nowadays when we are using Windows 7 , anyone hardly uses windows DOS commands . This page is bookmarked for future reference :)
MonsterBuzz! : Wow. There are a lot of them but I guess I don't use most of them though. Btw, it's interesting to see various commands that I never see before this. Amazing.
Pavan Somu : The command keys are nice... I don't know many of them till now.
Debajyoti Das : Thanks Pavan.......
Debajyoti Das : Thanks ..... :) Many were unknown to me too.... but not now....
Debajyoti Das : Thanks Sourish..... :) I remember how we used to make our friends awe by using only a few of these :P
Me : something for Map A Drive Letter to a Folder: When i try to do this, it fails because I hav spaces and &s in my path... How do I fix it?
anjali dadhich : Thanks….. it is very useful tricks I remember how we used to make our friends awe by using only a few of these
dinubhati : hello, actually i wrote on command prompt as: subst w: c:\windows through this there created an another drive named W, now i wanna delete that then without format how can i perform that.... plez help me...
Sairam Maddipati : To delete map drive just type in command prompt like this:- SUBST /D W: - Hit Enter, thats it u r done.
Debajyoti Das : @Sairam Maddipati: Cool Tip, thanks :)
avinash : really nice one.. give us sum more funny tricks....
ansatsu : i tried using the tasklist command and it says thats its not a recognized command? please help
Robert : To shutdown computer all you have to do is shutdown -i
Joe : hey, how do you stop the daily defragmenting of your cpu? i started it, and wondered how you could stop it.
rob : I dont think anyone can help you with that one Joe, I wasn't even aware you can defrag a CPU.
leo : pls hw do i remove d window7 on my drive D witout losing my documents.I already have windows 7 on C: so i dont need dat on D: again.tanx
vamsi : good job very useful
Arbiter : great job, would you recommend defragmenting at least monthly?
dev : i need study,you help me....pleeessss
mus : thank's bro
Sanctifactficationisation : Thanks for your good and kindly presentation of commands i will always remember this website
dave : nice i have seen all.am satisfied on all.tnx teaching me...
cukireznor : nice info..i m a newbie.
matt : if you put "shutdown -i" with out this " into cammand promt it will let you shutdown remote computers on the same network that your on and it can help for unresponsive computers or if you want to shutdown your sons/duaghters computer without them doing it also great prank at work or school
allen : hi, i told my friends how they can shutdown a computer remotely...but now they have started doing it to me...:(...how can i stop my computer from remotely shutting down when i am not the administrator??????
allen david : hi, i told my friends how they can shutdown a computer remotely...but now they have started doing it to me...:(...how can i stop my computer from remotely shutting down when i am not the administrator??????
neeraj : i jst created another drive and now i want to undo how can i do that plz reply
kapil verma : hi admin can u send me some awsome hacking tricks on my mail id can u do it if u can i will be realy thankful u :D
Jet lis : Zzzz.......nice bt very poor tricks
rennov : beautiful arts I guess... How could you know that trick?
echo %username% : you should ping there local computer and use the if errorlevel command so that if errorlevel=0 (shutdown -s -f -m \\remotecomputer -t 0) that way when there computer joins the network, BAM. (syntax maybe incorrect as i havent tried doing it :P)
okutey : man thats great stuff there...i use to think freeks in movies where lies but i guess they exist
echo %username% : Haha your the one searching for hacking tricks on the internet so your not going to find someone like you writing awesome comments like mine :) also learn some scripting, tbh you probably couldn't even parse data using dos ;)
H4X0|2 : hey, First of all why the !@#$ are you remotly shuting down P.C's anyway you could be doing much more like creating proxy servers, hacking and ECT. well, this command dose not workon windows xp (I know wht your thinking) window XP well, i can't get over it it's plne pro back to the point is there any way i can get this to work on windows XP? well, can you -H4X0|2 out
H4X0|2 : lol... can i?
Sairam Maddipati : To change the color of text use color command. CMD - COLOR 0 (black) COLOR 1 (blue) UPTO 9 YOU CAN EVEN USE ALPHABETS FROM A TO F CMD - COLOR A (GREEN) COLOR B (LIGHT BLUE) COLOR C (BROWN) UPTO F WORTH TRYING....
Sairam Maddipati : USE TASKLIST COMMAND TO VIEW THE SERVICES AND APPLICATIONS RUNNING IN THE SYSTEM. USE TASKKILL COMMAND TO TERMINAL THE SERVICE OR APPLICATION IN THE SYSTEM.
Sairam Maddipati : Sairam Maddipati : USE TASKLIST COMMAND TO VIEW THE SERVICES AND APPLICATIONS RUNNING IN THE SYSTEM. USE TASKKILL COMMAND TO TERMINTE THE SERVICE OR APPLICATION IN THE SYSTEM.
Sairam Maddipati : Sairam Maddipati : USE TASKLIST COMMAND TO VIEW THE SERVICES AND APPLICATIONS RUNNING IN THE SYSTEM. USE TASKKILL COMMAND TO TERMINATE THE SERVICE OR APPLICATION IN THE SYSTEM.
» Leave a Reply