Thanks for the detailed reply. Now those square brackets are for optional
switches right?
Now if it is [[/c | /k] string] how would you interpret it? i would in
simple sentences say for string it would be /c or /k or none. Correct me if i
am wrong here please. Does cmd act like a backend for command?
:
No, count the brackets. They need to match. I suppose the third opening bracket should be a brace. These rules are 25 years old and noone read the docs on them. They are well known.
Type
command /? For Dos 5.5 (Dos 5 on NT 5.1). PS /K etc is supported but is somewhat meaningless as anything typed in command is given to cmd for execution (ie command issues a cmd /c <whatever you typed> - see later for an experiment). Only /c and /k can run Dos 5.5 commands as old dos programs used this to shell to dos and they expect dos commands. If you want the real list get a dos 5 manual.
C:\PROGRA~1\SUPPOR~1>command /?
Starts a new instance of the MS-DOS command interpreter.
COMMAND [[drive:]path] [device] [/E:nnnnn] [/P] [/C string] [/MSG]
[drive:]path Specifies the directory containing COMMAND.COM file.
device Specifies the device to use for command input and output.
/E:nnnnn Sets the initial environment size to nnnnn bytes.
/P Makes the new command interpreter permanent (can't exit).
/C string Carries out the command specified by string, and then stops.
/MSG Specifies that all error messages be stored in memory. You
need to specify /P with this switch.
Is how Dos 6.22 puts it
Syntax
COMMAND [[drive:]path] [device] [/E:nnnnn] [/Y [/C command|/K command]]
Is how Dos 7.1 shows it.
COMMAND [path] [device] [/E:nnnnn] [/P] [/Y] [/Z] [/F] [/D] [/C command|/K command]] [/MSG] [/L:nnnn] [/U:nnn] [/LOW]
So on command doing what you are doing sets a dodgy location for command.com so it won't be able to reload itself. So if command gets swaped out, which depends on how much memory a program it starts uses, it will crash on return. Or if interpreted as a device the keyboard won't work.
To show what command does.
=======================
Type command
Type pause (we need to pause this as cmd runs and exits quickly)
Open a new Command Prompt window
Type (maybe only on Pro) which lists
wmic process get name,commandline
Dos and Win16 programs run in the emulator NTVDM (NT Virtual Dos Machine). Win 16 needs Win16 (known as WOW for Windows on Windows) as well as the Dos machine.
--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
It says cmd [[/S][/C|/K] string] here. Now isn't /c and /k optional for the
string there?
:
No it doesn't. It says nothing like what you said. Count the brackets. Cmd /? gives the switches in different order. Perhaps the brackets will make more sense there for you.
--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
But in the documentation it says for cmd.
Starts a new instance of the command interpreter, Cmd.exe. Used without
parameters, cmd displays Windows XP version and copyright information.
Now what is that string parameter for? And in the syntax it clearly says for
the string parameter the /c and /k are optional..
:
Well it hasn't been that way for twenty five years.
--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
Hi,
In windows xp when i go to start->run and then type cmd dir or cmd <any
cmd> then it doesn't execute the command. But when i do cmd /k dir or cmd /c
dir or cmd /c or /k <any cmd> it executes. In the help they have said that /c
or /k is optional.
cmd [[{/c|/k}] [/s] [/q] [/d] [{/a|/u}] [/t:fg] [/e:{on|off}] [/f:{on|off}]
[/v:{on|off}] string].
Shouldn't string execute with just cmd <some cmd> without the switches ?
Please help me with this.