中国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-08-05 05:20
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Check if the drive letter exists, Call the script.
Printable Version  1,804 / 3
Floor1 sweetdreamlan Posted 2006-09-21 05:34
中级用户 Posts 92 Credits 244
@echo off
if exist d: call d.bat
if exist e: call e.bat
if exist f: call f.bat
if exist g: call g.bat
if exist h: call h.bat
if exist i: call i.bat
pause

_______________________________________________________
Content of D.bat

D:
for /f "tokens=*" %%i in ('dir /ad /b') do attrib +h "%%i"
_______________________________________________

The contents of other *.bat are all the same as D.bat, just with different drive letters.

Running result:
Only d.bat is called, and the other bats are not called.

Floor2 sweetdreamlan Posted 2006-09-21 09:17
中级用户 Posts 92 Credits 244
...Experts, please give guidance, why is this happening
Floor3 sweetdreamlan Posted 2006-09-21 10:07
中级用户 Posts 92 Credits 244
Solution. Hey...
When calling d.bat, it has already switched to the D drive directory
Then when calling e.bat, it can't be called. Need to switch back to the current directory
Floor4 bd123456789 Posted 2007-06-30 11:17
中级用户 Posts 216 Credits 360
I tried it. No settings are needed at all, and the program can run all!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023