Winsmarts.com

Microsoft MVP

MVP Logo

Awarded the Microsoft MVP Award.

Hosted By

blah!bLaH!BLOG!!

Command Line Tricks

Because I'm a closet Unix-o-sexual!!

Posted on 6/30/2006 @ 8:51 PM in #Vanilla .NET | 8 comments | 31383 views

I am a self confessed Command Line Junkie. Here are a few tricks I use commonly that I can think off the top of my head.

1. Find a file on your hard disk - (This beats the Search doggie in Windows)
      dir filename /s

2. Find a file on your hard disk without all the directory info goo -
      dir filename /s/b

3. Create a list of files, say your MP3s to share with a friend? (disclaimer: don't do this piracy crap)
    dir *.mp3 /b > filelist.txt

3. Find a directory -
      dir dirname /s /ad

4. Move between directories easily
     C:\Documents and Settings\Sahil Malik>pushd .
     C:\Documents and Settings\Sahil Malik>cd \
     C:\>popd
     C:\Documents and Settings\Sahil Malik>

5. A better prompt for PushD and PopD via Craig Andrea.

6. Hit Tab for directory/filename compleition

7. Press F7 for a previous command list. User Cursor keys to select the command you need.

8. View all environment variables
SET

9. View only system variables that start with W
Set W

10. View a particular env. variable
ECHO %WINDIR%

11. Find what process has opened what port
netstat -noa

12. Widen your command prompt.
mode 120,100

13. View your TCP/IP settings.
netsh interface ip show config

14. Weird looking colors
color 8f

15. Find a string in a list of files, for example "Foo" in all .cs files in your project tree:
findstr /i /s "foo" *.cs

(You might know that the windows search doggie does an awful job at search thru files, I think it just ignores files with recognized extensions, so .cs will be ignored YUK).

16. refresh the netbios nametables:
nbtstat -R


On 8/5/2006 11:13:59 AM SRK said ..
Very useful mate !


On 11/21/2006 2:59:17 PM Mike P said ..
In another discussion at the site , you made the following comment:

p{color:black;} I am a self confessed Command Line Junkie. Here are a few tricks I use commonly that I can think off the top of my head. 1. Find a file on your hard disk - (This beats the Search doggie in ...

Can you tell me what you mean by "p{color:black;}"? I'd really like to have a different color for my prompt (and only the prompt), but I haven't been able to figure it out. I'm wondering if this might be a solution, although I'm not clear on how/where to insert that syntax.

Thanks, Mike


On 11/21/2006 3:00:16 PM Mike P said ..
I forgot to add the link to the other discussion. Here it is:


http://pluralsight.com/blogs/craig/archive/2005/01/12/4923.aspx


On 11/22/2006 1:46:12 PM Sahil Malik said ..
Mike - I'm not sure if I understand your Q.


On 5/12/2008 11:30:38 AM Tikoro said ..
Mike: the p{color:black} was a piece of CSS that was not put in the right place to be interpreted by your browser. It is not DOS syntax..it is used to styling the output display of a webpage.


On 9/15/2008 5:07:15 PM Dennis said ..
Very very cool... just what I needed, thanks!


On 12/9/2008 8:21:43 PM Anonymous said ..
Pfft. DOS isn't a command line, it's a children's toy. Ever try BASH? ZSH? You Windows sufferers are so clueless about the alternatives. You can't even do that many nifty tricks with the Windows command line.


On 12/25/2008 1:35:42 AM SomeDude said ..
DOS is for pansies

Bash, Cshell those are command lines

DOS is like the retarded offspring of an 4th generation alabama cousin couple

wait wat

Please post your comments:


Your feedback will be submitted for moderation, and will appear after it is approved.

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Site designed and maintained by Sahil Malik | All Rights Reserved. ©2007 WinSmarts.com.