Windows Xp Cmd Problem.

G

Guest

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.
 
G

Guest

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..


David Candy said:
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
=================================================
darkie said:
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.
 
J

Jon

darkie said:
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.

The commands do run, they are just not visible.
When you type 'cmd dir', have a look at the list of tasks running in Task
Manager, (ctrl-alt-delete), and observe the number of instances of cmd.exe

Jon
 
J

Jon

Jon said:
darkie said:
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.

The commands do run, they are just not visible.
When you type 'cmd dir', have a look at the list of tasks running in Task
Manager, (ctrl-alt-delete), and observe the number of instances of cmd.exe

Jon

Ok, perhaps they don't run after all

Jon
 
G

Guest

It just starts a new shell with the name cmd dir. Try it out by doing del
test.txt and make sure there is a file called test.txt. It won't have deleted
it. The string without /c or /k will give a new name to the cmd shell.

Jon said:
darkie said:
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.

The commands do run, they are just not visible.
When you type 'cmd dir', have a look at the list of tasks running in Task
Manager, (ctrl-alt-delete), and observe the number of instances of cmd.exe

Jon
 
G

Guest

It says cmd [[/S][/C|/K] string] here. Now isn't /c and /k optional for the
string there?

David Candy said:
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
=================================================
darkie said:
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..


David Candy said:
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.
 
G

Guest

well it says cmd [[/s][/c | /k] string]. Now here isn't /c and /k optional
for the string? Correct me if i am wrong.

David Candy said:
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
=================================================
darkie said:
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..


David Candy said:
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.
 
D

David Candy

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
=================================================
darkie said:
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..


David Candy said:
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
=================================================
darkie said:
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.
 
D

David Candy

No they don't. Cmd on it's own (ie no switches) starts a new instance of cmd. Type exit to exit this new instance. Remember the window is just a console window, it isn't a program - programs run in this console window. Cmd is only one of many programs that use a console window. No other console program requires cmd. Dos programs also run in the console and these do require command.com to be loaded (but windows loads it for you). Programs can create a console (as typing cmd in Start Run does), use an existing console (as typing cmd in a command prompt does), or create a GUI window (or do nothing and be invisible).

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
Jon said:
darkie said:
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.

The commands do run, they are just not visible.
When you type 'cmd dir', have a look at the list of tasks running in Task
Manager, (ctrl-alt-delete), and observe the number of instances of cmd.exe

Jon
 
D

David Candy

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
=================================================
darkie said:
It says cmd [[/S][/C|/K] string] here. Now isn't /c and /k optional for the
string there?

David Candy said:
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
=================================================
darkie said:
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.
 
G

Guest

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?

David Candy said:
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
=================================================
darkie said:
It says cmd [[/S][/C|/K] string] here. Now isn't /c and /k optional for the
string there?

David Candy said:
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.
 
J

Jon

Just accept that you need a /c or /k with your command and move on. It's way
too trivial a problem to get bogged down in.

Jon


darkie said:
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?

David Candy said:
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
=================================================
darkie said:
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.
 
D

David Candy

I've answered all your questions in detail. cmd acts as a backend for commands typed (note the word typed).

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
darkie said:
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?

David Candy said:
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
=================================================
darkie said:
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.
 
G

Guest

i am really sorry for asking this again but please tell me why do i need to
count the brackets?
I am getting this in cmd/? If it matches what happens?

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

Now just tell me this one thing. isn't /c or /k optional for string?
Shouldn't it be [/C string | /k string]?
I will be very grateful for the reply.

David Candy said:
I've answered all your questions in detail. cmd acts as a backend for commands typed (note the word typed).

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
darkie said:
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?

David Candy said:
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.
 
T

Tim Slattery

darkie said:
i am really sorry for asking this again but please tell me why do i need to
count the brackets?
I am getting this in cmd/? If it matches what happens?

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

Now just tell me this one thing. isn't /c or /k optional for string?
Shouldn't it be [/C string | /k string]?

Reading the explanation for the /C and /K strings makes it clear that
you would use one or the other, not both. The syntax notation says
that if you supply a string (if you don't it just opens a shell and
waits for a command) then you can (1)optionally use the /S flag, (2)
specify either /C or /K, or omit them both, then (3) after specifying
or omitting those flags, you type the string.
 
D

David Candy

F$^k off idiot.

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
darkie said:
i am really sorry for asking this again but please tell me why do i need to
count the brackets?
I am getting this in cmd/? If it matches what happens?

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

Now just tell me this one thing. isn't /c or /k optional for string?
Shouldn't it be [/C string | /k string]?
I will be very grateful for the reply.

David Candy said:
I've answered all your questions in detail. cmd acts as a backend for commands typed (note the word typed).

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
darkie said:
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.
 
G

Guest

Thanks for the reply. I wanted that explanation very much. Now in point 2)
you say specify either /c or /k or omit them both. Now I omitted both of them
but specified only the string as in 3) where you say omit them both(or
specify it). Now what should the behaviour of cmd be with only the string and
no switches at all? It is not documented anywhere. Please correct me if I am
wrong.

Tim Slattery said:
darkie said:
i am really sorry for asking this again but please tell me why do i need to
count the brackets?
I am getting this in cmd/? If it matches what happens?

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

Now just tell me this one thing. isn't /c or /k optional for string?
Shouldn't it be [/C string | /k string]?

Reading the explanation for the /C and /K strings makes it clear that
you would use one or the other, not both. The syntax notation says
that if you supply a string (if you don't it just opens a shell and
waits for a command) then you can (1)optionally use the /S flag, (2)
specify either /C or /K, or omit them both, then (3) after specifying
or omitting those flags, you type the string.
 
D

David Candy

Piss off idiot, everything has been explained to you. You are a grade A moron.

--
--------------------------------------------------------------------------------------------------
Goodbye Web Diary
http://margokingston.typepad.com/harry_version_2/2005/12/thank_you_and_g.html#comments
=================================================
darkie said:
Thanks for the reply. I wanted that explanation very much. Now in point 2)
you say specify either /c or /k or omit them both. Now I omitted both of them
but specified only the string as in 3) where you say omit them both(or
specify it). Now what should the behaviour of cmd be with only the string and
no switches at all? It is not documented anywhere. Please correct me if I am
wrong.

Tim Slattery said:
darkie said:
i am really sorry for asking this again but please tell me why do i need to
count the brackets?
I am getting this in cmd/? If it matches what happens?

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]

Now just tell me this one thing. isn't /c or /k optional for string?
Shouldn't it be [/C string | /k string]?

Reading the explanation for the /C and /K strings makes it clear that
you would use one or the other, not both. The syntax notation says
that if you supply a string (if you don't it just opens a shell and
waits for a command) then you can (1)optionally use the /S flag, (2)
specify either /C or /K, or omit them both, then (3) after specifying
or omitting those flags, you type the string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top