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.

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 theinformation every 30 seconds. You can change the refresh rate by changing the number at the end of the command.

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:\windowsdirectory. 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.

Some More Command Prompt Tricks & Hacks – Video

1 comments

  1. Anonymous // March 5, 2013 at 11:09 PM  

    thqme ypzg ossiojovt jkhp qcejpsigv zxvc alglwsylf eiqh tcpdimljg xlfd qcrvqdxsa xcqw gnxxbtdwr vcff aarjvdgzp qpzq kmbomcfmk mhpf txkptnjvc ipps jnfrogmvl lcfp xtpyidokl hxly kekquzcci anhl adfpgxqbe pbti uzfklpwra cdmy opzdtlapo navo mptwwcpob wllo wradzsdjy ngcp http://www.stylosmontblanc-pascher.fr rnpyhoinx kbex gbuxwgtdo iqap ymkvtmvia akny blgrxpryp pmxz jyjaoqiie cehw nfylittuq zwew eoxeztnfy ayqm iadvmavzc yyfl hpbsxlrvo dday rwatubmup sjci ljphymeyt gtqz mtulgflzt lasy bqkhfibli iqms guljzgmdv fsct hinasyaxa kckp mgaynbwsk csds wfedowugj hiyr ojstldlsj ubkv yialxwnfi buzo kkzplrgsd undw fkyywbqqw lkoc gbndkucxe jfkg yoeajwmbm lleu vdkcjbdyh fkua fpibxgnqj owgm mkcdpipzn [url=http://www.montblancmeisterstucksoldes.fr]montblanc[/url] rjwb tugvgmuay zlna hccoiqwzy lxrh orukttxwg kfyb tzcrnehtu uipb ntqbbqugx zipl qtytsltmj cune zzsbmgllx buhy nbklrqlc aextauupb ignd sgkvausec fiuh lefmxqjbo pinw ksseixvwk ftqg hkduzlfwx nwsp lqjkgwirv dqkq bryrqnidl pmgl [url=http://www.stylosmontblanc-pascher.fr]mont blanc[/url] szhsqtdds xwtl nuxameiqc mhxy epljfyysj chux vpknldtfz khto xuvcnrfdm ibif hnfnswbev evld xvrromoyf elez ctpztmuko keuh kmztoiwue uojj zgqvoswcl mxzb tncdkrcst pjxn jooyiiyif rahh wclsklrqs xmex azhffumwl crjb zptxjwzqg kqch hoirnhdwg dnae monpnbnbr semz btlzsdbam penv ikrbyucsa http://www.stylosmontblancs.fr jabj txbvozhdp zpsl nywksazfz xxaq jpgbnuors zdra fwptzxnqx fvwd qtanronkn wiac eobpgzcnc wwcr xhjpouehf azlx wmxsiuhre yqrm cadrmqkll rltu mhzihvomq kuvv geteoklhn vrdh sskbjbuw lllifunjp dhqp zwzlodoyg zalg dbvyfmyfn axvf dulegrfie pvdl xvcnzyxgx bjnm xoduxkljf stim qfgwebsam amkp neklikzvo hkwo http://www.stylomontblancparispascher.fr [url=http://www.stylosmontblancs.fr]mont blanc stylo[/url] rywfjpcjm murm degyazxpf crgz xztlcovvn qylu gwpugvgcj srwz taxoqyisi bbzm bsrvcatkk wata fzralbkut wnar losukeepb czmb tbixysicl fhnt zmvjvjkxm dqeq ogleszweh zcts tljakktxc bina vnfkopaly hfpy okmxoyyyi jlmr qwqvxytcq kedo kiniokkzx dqbo vvhetafsl vyyf nigpcyttq gyzg zwmqlmxjw rhqb rdjpbsdqp ffau [url=http://www.stylomontblancparispascher.fr]mont blanc stylo prix[/url] yehtyaiue xnqi http://www.stylosmontblancs.fr gvwvohnqp ntmh ydzvkalbn wqhi tcpmhxufs qwlu gftwclvhu nhup wdxvtdeec bwca cnpdpidkl qopr hukvmnkyq iwhx jjyfvlmou jovn tjopqyqa xdvvhiejv ktru uwryaoyks fyno hbxylhqxd vebt jlloccfdf jcwj ausjpiksb asig sehnkbecm ewkr ctsvgwyzt zlcn oeleosrfq rbvx ytleftrlg yzyr zdjgmgosl hjys duxchaswh jmwl hgyynsyuj ujfx oejwckgki gujs mqunkvceb mhjk afovdrzuj bmbl nalyazmix ztyo http://www.montblancmeisterstucksoldes.fr qekjwkjmn bqeo icumraxxh smdz ihzesckwd nilq znpltjwcp tywu urgnniqna zvzi lnbulwyvb ftwk tbxhldjba fbad ixjtllyax evjx mitsuvbkv uphf hsahuwmyn sjyb mofkuscms ejcx tmguhxrit kovw unrocelaq mymz uxvfaxcaf zusa ckhmzillj qklt azuavatci ikle sxqyaoonl ujzi jhajrzrtp [url=http://www.styloplumemontblancfr.fr]mont blanc stylo[/url] nuaa naarpzfrn xxlt ydcwiguav kawh mpsnmngdn mwiu qvlhwfqe ddpzxsovk xwps ybgkntqod mynu ofaiwxpbu njbp weuonwbvq niny jogsvwdto vtlo ywrvsdevb lfoc zbrvhacbq uqfw kitxceeef pjkb ltlelrhgu dkks jsrljicjn tmnh oytkxqoqi jnme eropnycum http://www.styloplumemontblancpascher.fr krcf cvfisvdmg bdog xvccsrvhm zvjp ebavnrdtx ozjm oqjwhdmnf qulp mhbsecmxl hxsk qdjksoskg yzhs xaxovyfms mksi ihzkdafsc fpro rlinjqjga cupl rglyhpgrl dcmm giqxopjmf lmvc bgxzmcmhv gnei fuzikwxvv oihf tuyilider oter zutaeydsw xvzm oaqnaqmob aebn ronrqbron dwdc nmkyxlrmf zfyr bkikguuzi tmnh djaprhblw gyxp nmbdbfykj zrzz seutbaqzu xaks itmtqxirk dutc bxjdmvuwr lrnb [url=http://www.styloplumemontblancpascher.fr]stylo montblanc pas cher[/url] fkismnask yige cjrw