中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-22 09:40
47,812 topics / 349,917 posts / today 0 new / 48,272 members
DOS批处理 & 脚本技术(批处理室) » Please tell me the calling method of COMMAND in the batch file?
Printable Version  1,785 / 6
Floor1 icevan Posted 2005-08-19 00:14
初级用户 Posts 12 Credits 67
Floor2 JonePeng Posted 2005-08-19 15:07
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Running COMMAND will directly load a new COMMAND and prompt the DOS version number and command prompt. You can try running COMMAND, then run a batch script that needs to automatically respond to "Abort, Retry, Fail", and finally exit, then the new COMMAND will automatically exit and return to the original state without automatic response.

COMMAND /F
F.BAT
EXIT
Floor3 willsort Posted 2005-08-19 16:30
元老会员 Posts 1,512 Credits 4,432
Re icevan:

The command /f requires the /c switch to call the batch program or internal and external commands for which you need to ignore error prompts; of course, the problem cannot be simply solved by using command /f. You can refer to the following link:

{12892}Discussion about "Hard Disk Killer" Batch Program
Floor4 icevan Posted 2005-08-20 21:41
初级用户 Posts 12 Credits 67
Thanks to the two upstairs for helping.

Now there is a new problem:
Calling the F.BAT file with COMMAND/F/C can automatically respond to "ABORT,RETRY,FAIL" and then exit this new shell (I don't know if it's correct to call it a shell).
But the variable romcd generated in the new shell also disappears. How can I add the variables in the new environment to the original environment? The new environment can inherit the variables in the old environment.

I tried it myself~ Found a stupid way to add the variables of the new environment to the old environment, modified F.BAT to:

if exist %cdrom1%\tools\vc.ini goto cd1 (VC.INI is a file in the CD)
if exist %cdrom2%\tools\vc.ini goto cd2

:cd1
set romcd=%cdrom1%
echo set cd-rom=%romcd%>scd.bat
goto end

:cd2
Then call the SCD.BAT file. Please let me know if anyone has a good method?
PS: <Discussion about "Hard Disk Killer" batch processing> I don't understand because of insufficient ability~~
Another PS: When COMMAND/F/C F.BAT is executed, it automatically responds to the selection, but the prompt of ABORT,RETRY,FAIL still appears on the screen~ How can I make it not display?

[ Last edited by icevan on 2005-8-20 at 22:49 ]
Floor5 JonePeng Posted 2005-08-20 22:14
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Originally posted by icevan at 2005-8-20 21:41:
But the variable romcd generated in the new shell also disappears. How can I add the variables in the new environment to the original environment? The new environment can inherit the variables in the old environment.


Hehe, the owner's question has caught my attention. I never expected such a situation.

As a command interpreter, Command.com runs on the DOS platform built with IO.SYS and MSDOS.SYS. Command is like Explorer.exe in Windows, so let's姑且call it the shell of DOS.
Floor6 willsort Posted 2005-08-20 22:43
元老会员 Posts 1,512 Credits 4,432
Re icevan:

The command is fully called "shell". You can see from the shell command in config.sys used to load the command that the kernel at this time should be io.sys (in the old version, there is also msdos.sys). They provide many interrupt services and device ports for frequent calls by the "command interpreter".

As for the return of environment variables, you can first save the variables in the sub-shell (new shell) to the batch program, for example, echo set var=%var%>_return.bat, and then extract it after returning to the parent shell (old shell). For example, call _return.bat.

In addition, if you find that discussion too abstract, you can refer to this post:

{8804}Password program that can customize password (batch processing)

[ Last edited by willsort on 2005-8-20 at 22:45 ]
Floor7 icevan Posted 2005-08-20 22:52
初级用户 Posts 12 Credits 67
After reading <Discussion about "Hard Disk Killer" Batch Processing> again, I solved the problem of shielding the ABORT, RETRY, FAIL prompts. But there is another problem~
"In XP and other NT - like command lines, ctty is canceled. In such an environment, you can only redirect error messages through 2> nul. "
How to do double redirection to NUL?

[ Last edited by icevan on 2005-8-21 at 16:22 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023