Questions on switches and child shells
Moderator: DosItHelp
Questions on switches and child shells
I just started learning DOS today and I have been using this http://www.allenware.com/icsw/icswidx.htm as my guide. However there are several things that confuse me. When starting on lesson 2 http://www.allenware.com/icsw/icsw020.htm I found that the command "command /z /k" wouldn't create a new child shell that allowed me debug my program, and that the command "command /y /c" would not let me do a step by step debugging.
So my question is why don't any of these work? Is it because it was written for windows 98 and xp, and if this is the case is there a new better way to do what they are suggesting?
On another note I was wondering if there is anywhere where I can find a list of the switches used in DOS because I would like some better definitions.
Thank you.
So my question is why don't any of these work? Is it because it was written for windows 98 and xp, and if this is the case is there a new better way to do what they are suggesting?
On another note I was wondering if there is anywhere where I can find a list of the switches used in DOS because I would like some better definitions.
Thank you.
Re: Questions on switches and child shells
tryied "command.com /?" in dos window it came up with switches but ther is no such /K switch try it.
Re: Questions on switches and child shells
I did the same, but it does do what they said it does, but is there even a reason to do what they are asking or is it unnecessary?
Re: Questions on switches and child shells
sorry i'm confused
with your question what are u using command for?

Re: Questions on switches and child shells
'
Hi TNTBlast, I learned batch using the same site, a lot has been added since
My advise, don't use command.COM unless you grew up with it ( you won't need it ).
The modern command line interpreter is cmd.EXE.
This will let you debug your batches
Hi TNTBlast, I learned batch using the same site, a lot has been added since

My advise, don't use command.COM unless you grew up with it ( you won't need it ).
The modern command line interpreter is cmd.EXE.
This will let you debug your batches
Code: Select all
start "CMD" %comspec% /k "Hello world !.CMD" /arguments
Re: Questions on switches and child shells
TNTBlast wrote:I just started learning DOS today and I have been using this http://www.allenware.com/icsw/icswidx.htm as my guide.
Unless you really mean "DOS" as in "16-bit MS-DOS", I wouldn't recommend that particular tutorial. On the page you linked, it is clearly stated that it's for (the DOS based) Windows 9x/ME. Incidentally, there is also a clickable popup labeled "NT/2000/XP" towards the top of the page, which answers your direct questions: there is no /z "return-code" nor /y "debug-mode" in CMD.EXE.
Since it looks like you've found this forum

Liviu
Re: Questions on switches and child shells
Thank you for your responses I understand now.
Ed could you please elaborate on what the code you just posted means (especially the /k switch)?
Liviu which resource from dostips would be the best to start at?
Ed could you please elaborate on what the code you just posted means (especially the /k switch)?
Liviu which resource from dostips would be the best to start at?
Last edited by TNTBlast on 04 Apr 2012 20:01, edited 1 time in total.
Re: Questions on switches and child shells
'
Hello world !.CMD
debug_Hello world !.CMD
Hello world !.CMD
Code: Select all
@echo off &cls
echo.
echo.%~n0
echo.
echo. Uses the /k switch to prevent crashes,
echo. I use it to debug my batch files ;)
echo.
pause
cmd /?
pause
exit 0
Code: Select all
@echo off &start "CMD" %comspec% /k "%~dp0\Hello world !.CMD" /arguments
Re: Questions on switches and child shells
Sorry ed but could you make your post more clear?
1)First how does /k prevent crashes and what does it do specifically?
2)What does /arguments mean? Is it a comment you are making or a command?
3)What does "%~dp0\" mean?
4)How does this debug specifically?
Thank you.
1)First how does /k prevent crashes and what does it do specifically?
2)What does /arguments mean? Is it a comment you are making or a command?
3)What does "%~dp0\" mean?
4)How does this debug specifically?
Thank you.
Re: Questions on switches and child shells
TNTBlast wrote:Liviu which resource from dostips would be the best to start at?
"Best" is in the eye of the beholder

Liviu
P.S. As for the /k switch, run "cmd /?" at a command prompt, and it will tell you that it "carries out the command specified by string but remains". Most commands display their own help when run with "/?". Among the better documented I'd count "cmd", "set", "call", "if", "for".
Re: Questions on switches and child shells
So is there any other way to create a child shell that will return the error level of everything you do? (Look here to see what I mean http://www.allenware.com/icsw/icsw020.htm it's in the middle of the page)
Re: Questions on switches and child shells
You can have a doskey macro to execute this:
echo %errorlevel%
echo %errorlevel%
Re: Questions on switches and child shells
Alright I think I'm fine now.
Thank you everyone who replied
Thank you everyone who replied
