Stupid Command Prompt Tricks

i wanna know how to change directories with
names like “mysql server” or "12345.0"
in command prompt

Easiest way to get persistant title and colors: Go to start, programs, accessories, then dragdrop the Command Prompt shortcut to somewhere on your desktop. You can rename it to get the title, right click-properties to change the color and stuff. When you open that shortcut, the colors and title should be the same

hey man, i’m a system administration student, and you just made my life a whole lot better with these tricks… no more boredom!

Persist the title?

The following, which if merged, puts a “Command Prompt” item on the Folder context menu, will set the title to the path where window was opened. It also makes that folder “current” and loads some DOSKEY macros. (The “doskey /insert” may be a holdover from earlier OS versions. Not sure it is necessary in XP.) I have also executed batch files from this command string which can do whatever batch files can do. The ampersands allow you specify more than one command on a single command line. They need to be doubled up in batch files and scripts like this.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Command Prompt\command]
@=“C:\WINNT\System32\cmd.exe /k cd “%1” doskey /insert doskey /macrofile=c:\bat\doskeymacros.mac title %1”

I would like to know how to make the shell window like other xp windows. I have a program(tweakwindows) that I downloaded just to keep my cmd.exe “always on top” but it seemingly only works on the fancy xp style beveled windows.
is this possible?

Make the title persistent??
Set the Environment Variable %comspec% to the title you want, done.

We still weren’t able to find out how we can change what sub directory the command prompts goes to when first opened.

We did go here but found nothing:


one way it seems to be possible is to make a shortcut to it then right click and select properties and type the sub directory in the start in box

Hey there. I’m new to CMD and got to working on it when scheduling a weekly defrag on XP, but when my defrag gets done running the screen automatically closes. Is there a way to make it not close? I also wrote a cmd for defrag c: -a so I can see a report, but it to runs the analysis and immediately closes. Thanks.

  1. Create a Batch file with the commands that you want executed at the time of the command prompt being opened. Save this Batch file in a location that you won’t delete (My Documents,etc)
    such as:
    cd /profiles/username

  2. Then open up regedit, and add that batch file to the following Registry entry.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
    There’s a variable called AutoRun.
    Right-click and Modify
    Add the path to your batch file in the Value Data field: (enclosed in Double-quotes)
    “C:\Profiles\username\My Documents\cmd.bat”

  3. Now go start a command-prompt, and watch it execute this batch file every time.

I use mine to set my initial directory, and execute ipconfig.

Also, this DOES NOT affect the Windows PowerToy “Open Command Window Here”. Your batch file will run (and change directory to your specified one), and then the command prompt will switch to the directory that you right-clicked on for the “Open Command Wnidow Here” action.

@Eugene Liedel:

there is a Sourceforge project with a tabbed console program…

do a search for it.


Do any of you know how to change your desktop background by using cmd.exe because they have blocked the Control Panel and the “right click set as desktop background” buttons at work??


Get the latest beta version, it’s fine.

i wanna make 2 batch files that send messages to eachother at set intervals and when one of the batch files is X’d out and stops sending messages ot the other, i want the other to know that and then shut the computer down how would i write this?

Question since you know what your talking about…
How do I make new variable with the set variablename command that will execute 2 commands for example
set variablename=mouse
set mouse=(time ipconfig)
??not sure ive tried the above example and no luck any ideas are greatly appreciated

As Norman said: I have a new XP laptop to replace my old one. For some reason, I can’t use the up arrow to scroll through previous commands. I’ve been searching for a way to turn that on. Can you help with that.

My computer doesn’t do this for some reason, either. Really annoying. Any help?


I found the answer (to my own question). :

On any Windows version but XP, enter the command doskey. This causes all subsequent commands you type in to be saved, and you can navigate backwards and forwards through these saved commands by using the up arrow and down arrow keys on your keyboard. Windows XP doesn’t require doskey—the feature is turned on automatically when you open a command-line window.

Basically, type ‘doskey’, and your problem is fixed. Whew.

i just got a new windows XP computer. i have it set so when the screen saver turns on, it atomaticly promts for the owner password. i was wondering if there is any command that you could enter into command promt that would show that password. i dont want it changed i just want to view it though. if there is could you email the command to me? my email address is
thank you very much

How do you do ‘Program Files’ i cant get the space between program and files is it like %20? coz i tried that

to change to a directory with a space in the name, surround the dir name with quotes, like this: cd “a bad folder name”

another option for the above folder would be to type cd a and then hit tab and it will auto-complete the quotes and the rest of the folder name