|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Articles
Join Date: Apr 2001
Posts: 0
|
Article Discussion
This is an article discussion thread for discussing the SitePoint article, "Kev's Command Prompt Cheat Sheet"
|
|
|
|
|
|
#2 |
|
I'll take mine raw
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Alabama, USA
Posts: 2,561
|
Ah, a blast from the past! Oh we were great command-line warriors at one time
![]() Want to run a program on every file in a directory? This passes the file name (minus the extension) of every .xcp file (in the "cwd") to a program called xc: Code:
@for %%f in (*.xcp) do xc %%~nf Want to have more control over your directory listing? This outputs a "bare" listing sorted ("ordered") by name: Code:
dir /b /on Code:
dir /b /on > dir_list.txt Let's say we have a directory of files named like this: beach001.jpg, beach002.jpg, beach003.jpg, beach004.jpg, etc. Now we realise those weren't beach pics at all! We want to replace "beach" with "work" for all those files... Code:
ren beach???.jpg work???.jpg Code:
ren beach???.* work???.* Code:
net share shared_src=c:\public\src Code:
net use x: \\main_server\shared_src Code:
c: cd \projects\old dir /on /s > ..\old.txt cd \projects\new dir /on /s > ..\new.txt cd .. fc new.txt old.txt > project_comparison.txt ![]() Disclaimer - It's been a long time since I used some of these. Note that you can screw things up with some of these commands. |
|
|
|
|
|
#3 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2004
Location: West Midlands, United Kingdom
Posts: 2,771
|
Quote:
![]() |
|
|
|
|
|
|
#4 |
|
SitePoint Zealot
![]() ![]() Join Date: Jun 2003
Location: ny
Posts: 132
|
heh this brings back memories...
|
|
|
|
|
|
#5 |
|
I'll take mine raw
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Alabama, USA
Posts: 2,561
|
ThanksThe Command Prompt (I still call it a "DOS Box" ) can be very useful - I use it often. One problem with opening a Command Prompt from the "Start" menu is that, after opening it you then have to "cd" (change directory) to the directory where you need to work. Here's something I did to help. The following creates a new action for the "Folder" file type. After doing this you can right-click on a folder (in the "Folders" view of Explorer) and select "Command Prompt" and it will open it with the "CWD" (current working directory) set to the folder you right-clicked on.On the main menu bar of Explorer (not 'Internet' Explorer) click "Tools", then "Folder Options...", then the "File Types" Tab. Now you see a list of file types. Look for one named "Folder". There is also one named "File Folder" - don't select that one, select the one named "Folder" (I have Windows XP Pro so things may be different for you now, depending on what version of Windows you have). Click the "Advanced" button. Now you get a dialog box named "Edit File Type" - it has a list of "Actions" (you'll probably see the "explore" and "open" actions already there). Click the "New..." button. Now you get a dialog box named "New Action" which has two text fields. For "Action" I used this: Command Prompt. For "Application used to perform action" I used this: C:\WINDOWS\system32\cmd.exe "%1". Click the "OK" buttons for all dialog boxes you opened. This has been very useful to me. I hope it is useful to you ![]() |
|
|
|
|
|
#6 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2004
Location: Right behind you, watching, always watching.
Posts: 5,940
|
damn I DO miss the days of the dos prompt even though I still use it a lot. I think thats why I enjoy the console on my servers so much ...... and the wonderful thing is? It ONLY does what you tell it to do (unlike some "other" apps we wont mention)
nice article ...... made me feel "homesick" for the good old days! |
|
|
|
|
|
#7 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Jun 2006
Posts: 222
|
Oh my gosh!
I absolutely LOVE DOS command prompts. I think I learned every single one. Then it all went to Windows. It's so funny...this article says it's a "mysterous utility." That's funny because it was the way you did things before it all went to these pretty little folders and such. ![]() |
|
|
|
|
|
#8 |
|
SitePoint Member
Join Date: Jul 2008
Location: UK
Posts: 17
|
Bah, get a real command line like bash or zsh
![]() |
|
|
|
|
|
#9 |
|
SitePoint Member
Join Date: Oct 2008
Posts: 1
|
how do you run a command (like net or something with a lot of sub commands) and have it appear in the prompt? i figured it out once but i forgot.
should look something like this if you do it correctly: C:\WINDOWS\System32>net> then you can type net start,config,etc. but without the net part. also might be like: C:\WINDOWS\System32\net.exe> thanks |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 06:19.









) can be very useful - I use it often. One problem with opening a Command Prompt from the "Start" menu is that, after opening it you then have to "cd" (change directory) to the directory where you need to work. Here's something I did to help. The following creates a new action for the "Folder" file type. After doing this you can right-click on a folder (in the "Folders" view of Explorer) and select "Command Prompt" and it will open it with the "CWD" (current working directory) set to the folder you right-clicked on.


Hybrid Mode
