command line question in Windows 2000

DeadSeaSquirrels

Senior member
Jul 30, 2001
515
0
0
A couple of questions, all relating to command line.

I am trying to setup a nice programming environment for myself, and I need to use the command line to execute my code. currently I am going to start->run and typing "command." however when I search for command.exe I can't find it, only cmd.exe, I figure that command must be some sort of alias or something, but I don't know anything about that, so can somebody explain to me how windows knows that when I type command it executes cmd.exe.

You might say just type cmd, what's the big deal. Well I am trying configure my MS internet pro keyboard to use the "media" button as a shortcut to an ms-dos screen with the current path set to my java directory. But instead if I link the media button to c:\winnt\...\cmd.exe, it goes to, you guessed it c:\winnt\...\.

Also is there a way to change the defualt directory I am in, when I first start up the ms-dos console. Is it a systems variable...comspec? (what is that comspec variable anyway).
 

Moonbender

Golden Member
Oct 19, 2000
1,046
0
0
You won't find a command.exe on a normal Windows system, but try looking for command.com and you might be surprised. And thus, running command does not start cmd.exe (which would greet you with the words "Microsoft Windows XP"), it starts command.com and greets you with "Microsoft(R) Windows DOS". I don't think there's any point in running command.com, use cmd.exe instead, it's more advanced in many ways - such as name completition on <tab>, although that has to be activated manually (see cmd /?) for details. It's also a proper Win32 application.

To run cmd.exe and start it in a certain directory, you use the /K parameter, which executes the line after the /K as a command and remains active. You also need to know that, while a normal cd (or chdir) will not switch the current drive - if you cd to a folder on another drive, you won't actually be in that folder, the parameter /D makes cd switch drives, as well.
So, to start cmd.exe in a certain directory, set it up like this: cmd.exe /K cd /D d:\your\path\here

This also works brilliantly as a context option for file folders, letting you create a "Command prompt here..." option, for those who know how to manipulate the registry in that way.

Finally, ComSpec is the environment variable pointing to the default command line interpreter. I'm not sure whether it has any use in the current Windows versions, beyond backwards compatiblity, that is.

HTH!
 

DeadSeaSquirrels

Senior member
Jul 30, 2001
515
0
0
Woah awesome, thanks for all the info, that was great. I was wondering why even though I set the autocomplete for tab, it didn't work. So what is command.com all about? And also, where did you learn all this?
 

Moonbender

Golden Member
Oct 19, 2000
1,046
0
0
I was wondering why even though I set the autocomplete for tab, it didn't work.

Hmm, it works for me. When I enter a partial file/directory name and press tab, it completes to matching paths. What did you use to activate it? The registry key controlling the setting (or at least one of them) is HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar - it should be a REG_DWORD and contain the decimal number 64.

command.com used to be the standard command line interpreter before cmd.exe came around. Windows 2000 was the first Windows version to have it, although it might have been around for a long time on the NT platform. Anyway, command.com is a part of Microsoft DOS, and so all operating systems built on top of DOS also had it. Windows 2000 and later only have it for backwards compatibility, I assume.

I picked up this stuff here and there - you basically had to know that there is command.com during the DOS days because it was your basic user interface. And all the other stuff I learned by asking around, or trial-and-error, or pure accident. For instance, I only found out there's a better command line interpreter in Win 2000 when I rummaged through the system32 directory (quite a few interesting utilities in there). The various help files are a great resource, as well, for instance I wasn't sure about the cmd.exe and cd parameters myself before posting, but a cmd /? and a cd /? quicky cleared that. There's also an excellent command line introduction and reference in the Windows help.
 

DeadSeaSquirrels

Senior member
Jul 30, 2001
515
0
0
I meant I always wondered why the autocomplete with tab didn't work before (that was when I was using commmand.com, not cmd.exe). I knew about command.com a long time ago too, when you had to create bootdisks to play games and stuff, but I wasn't smart enough to piece it together.

Thanks for the help and info. Now when somebody ask me about this stuff, they'll say "how did you ever figure this out?" and I can say a little birdie told me.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |