中国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-23 14:10
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Asking an expert about a variable issue.
Printable Version  2,317 / 11
Floor1 哑巴 Posted 2004-03-18 00:00
初级用户 Posts 37 Credits 270
I made a disk using DOS 8 system

Directory of A:\

2000-06-08 17:00 118,272 IO.SYS
2004-03-18 21:46 206 AUTOEXEC.BAT
2004-03-18 21:15 116 CONFIG.SYS
2004-03-17 22:54 134 nopri.bat
2004-03-18 22:10 2,111 FIXGHO.BAT
1999-10-10 08:01 45,379 SMARTDRV.EXE
2000-06-08 17:00 25,473 MSCDEX.EXE
1997-11-16 10:01 239,333 TW.EXE
2003-04-08 18:34 3,188 FINDCD.EXE
2004-03-17 22:51 125 nocd.bat
2004-03-18 00:37 1,396 FIXPIO.BAT
2002-12-12 18:27 8,666 WBAT.COM
2000-06-08 17:00 64,425 FLASHPT.SYS
2000-06-08 17:00 53,767 EXTRACT.EXE
2000-06-08 17:00 66,300 FDISK.EXE
2000-06-08 17:00 93,442 COMMAND.COM
2000-06-08 17:00 33,191 HIMEM.SYS
2000-06-08 17:00 41,302 OAKCDROM.SYS
2000-06-08 17:00 15,252 ATTRIB.EXE
2000-10-04 18:22 9 MSDOS.SYS
1998-06-19 20:01 6,855 FINDRAMD.EXE
=======config.sys=======
device=oakcdrom.sys /D:mscd001
device=flashpt.sys
files=40
buffers=10
dos=high,umb
stacks=9,256
lastdrive=z
=======autoexec.bat=====
@ECHO OFF
path=a:\;c:\windows;c:\windows\command
SET DIRCMD=/O:N
MSCDEX.EXE /D:mscd001
IF ERRORLEVEL 1 nocd
findcd >nul
IF "%CDROM%"=="C:" NOPRI
set path=%path%;%CDROM%\
smartdrv 2048 1024
fixgho
=======fixpio.bat========
@ECHO OFF
SET PIO=
IF "%CDROM%"=="E:" SET PIO=d:
IF "%CDROM%"=="F:" SET PIO=d:,e:
IF "%CDROM%"=="G:" SET PIO=d:,e:,f:
IF "%CDROM%"=="H:" SET PIO=d:,e:,f:,g:
IF "%CDROM%"=="I:" SET PIO=d:,e:,f:,g:,h:
IF "%CDROM%"=="J:" SET PIO=d:,e:,f:,g:,h:,i:
IF "%CDROM%"=="K:" SET PIO=d:,e:,f:,g:,h:,i:,j:
IF "%CDROM%"=="L:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:
IF "%CDROM%"=="M:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:
IF "%CDROM%"=="N:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:
IF "%CDROM%"=="O:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:
IF "%CDROM%"=="P:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:
IF "%CDROM%"=="Q:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:
IF "%CDROM%"=="R:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:
IF "%CDROM%"=="S:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:
IF "%CDROM%"=="T:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:
IF "%CDROM%"=="U:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:
IF "%CDROM%"=="V:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:
IF "%CDROM%"=="W:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:,v:
IF "%CDROM%"=="X:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:,v:,w:
IF "%CDROM%"=="Y:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:,v:,w:,x:
IF "%CDROM%"=="Z:" SET PIO=d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:,v:,w:,x:,y:
======nopio=======
@tw /np
@cls
@echo.
@echo.
@echo 错误:找不到可用的硬盘分区。
@echo 请按 连接上硬盘和分区后再用本光盘。
@echo.
@pause
@TW /Q
=====fixgho.bat=========
set wgho=
:fixgho
call fixpio
for %%i in (%PIO%) do if exist %%i%\ghost\system.gho set gho=%%i%
Why can't I set the value of gho here?
if "%gho%"#==# goto nogho
tw /np >nul
cls
goto res
:nogho
WBAT BOX "在您的电脑中找不到系统镜像文件,无法还原系统,是否要自动备份系统?",是,否 #1,32
IF ERRORLEVEL 100 GOTO end
IF ERRORLEVEL 2 goto end
IF ERRORLEVEL 1 goto write
goto end
:res
WBAT BOX "在 %gho% 盘找到一个镜像文件,请选择操作",系统还原,删除还原文件 #1,64
IF ERRORLEVEL 100 GOTO end
IF ERRORLEVEL 2 GOTO delgho
IF ERRORLEVEL 1 GOTO ress
goto end
:del gho
attrib -s -h -r %gho%\ghost\system.gho
del %gho%\ghost\system.gho
tw /q
fixgho
:ress
echo.
echo.
echo 警告:C: 盘上的数据将被完全
echo 删除并还原到上次备份的状态
echo 请确定您已经备份了 C: 盘上
echo 的重要数据才进行此操作
echo 确定还原请按任意键
echo 按 Ctrl+C 键取消此操作
echo.
echo.
pause >nul
echo %CDROM%:\GHOST\ghost -clone,mode=pload,src=%gho%\ghost\system.gho:1,dst=1:1 -sure -rb
goto end
:write
if "%CDROM%"=="D:" GOTO nodr
WBAT BOX "请选择要保存 C 盘系统镜像的盘符",%PIO%,取消 #1,64
IF ERRORLEVEL 100 GOTO end
IF ERRORLEVEL 23 set wgho=Y:
IF ERRORLEVEL 22 set wgho=X:
IF ERRORLEVEL 21 set wgho=W:
IF ERRORLEVEL 20 set wgho=V:
IF ERRORLEVEL 19 set wgho=U:
IF ERRORLEVEL 18 set wgho=T:
IF ERRORLEVEL 17 set wgho=S:
IF ERRORLEVEL 16 set wgho=R:
IF ERRORLEVEL 15 set wgho=Q:
IF ERRORLEVEL 14 set wgho=P:
IF ERRORLEVEL 13 set wgho=O:
IF ERRORLEVEL 12 set wgho=N:
IF ERRORLEVEL 10 set wgho=M:
IF ERRORLEVEL 9 set wgho=L:
IF ERRORLEVEL 8 set wgho=K:
IF ERRORLEVEL 7 set wgho=J:
IF ERRORLEVEL 6 set wgho=I:
IF ERRORLEVEL 5 set wgho=F:
IF ERRORLEVEL 2 set wgho=E:
IF ERRORLEVEL 1 set wgho=D:
if exist %wgho%\ghost\nul md %wgho%\ghost
echo.
echo 这是备份
echo %CDROM%\GHOST\ghost -clone,mode=pdump,src=1:1,dst=%wgho%\ghost\system.gho -sure -rb
goto end
:nodr
cls
echo.
echo.
echo 你的电脑只有一个DOS分区,无法备份系统!
echo.
echo.
pause
goto end
:end
tw /q >nul
@echo on
=====================

The problem is the red text above, please help from the expert!!!










Floor2 aria Posted 2004-03-19 00:00
高级用户 Posts 243 Credits 924
Hehe, it is suggested that you replace OAKCDROM.SYS with VIDE-CDD.SYS. Using FLASHPT.SYS, do you want to support special CD-ROM drives?

In addition, this post should not be posted here
Floor3 哑巴 Posted 2004-03-19 00:00
初级用户 Posts 37 Credits 270
Thanks for the advice from aria,

I am asking why I can't set the value of the gho variable in the fixgho.bat in the disk.
The echo is
if exist %PIO% <-This PIO value is correct.
Please help, great experts.
Floor4 哑巴 Posted 2004-03-25 00:00
初级用户 Posts 37 Credits 270
Please高手 take a look!!!
Floor5 Climbing Posted 2004-03-26 00:00
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
The way you use the for loop variable in your batch processing is problematic. I think it should be written like this:

for %%i in (%PIO%) do if exist %%i\ghost\system.gho set gho=%%i
rem Why can't I set the value of gho here?
if "%gho%"=="" goto nogho
Floor6 哑巴 Posted 2004-03-30 00:00
初级用户 Posts 37 Credits 270
Write "把for %%i in (%PIO%) do if exist %%i%\ghost\system.gho set gho=%%i%写成for %%i in (%PIO%) do if exist %%i\ghost\system.gho set gho=%%i可Dos会提示语法错误。" as "Write "for %%i in (%PIO%) do if exist %%i%\ghost\system.gho set gho=%%i% " as "for %%i in (%PIO%) do if exist %%i\ghost\system.gho set gho=%%i" and DOS will prompt a syntax error."
Floor7 Climbing Posted 2004-03-31 00:00
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
Is there a problem with your DOS 8? This is the result of the command executed step by step in the DOS window of Win2003:

D:\>set PIO=c:,d:,e:,f:

D:\>for %i in (%PIO%) do if exist %i\ghost\system.gho set gho=%i

D:\>if exist c:\ghost\system.gho set gho=c:

D:\>if exist d:\ghost\system.gho set gho=d:

D:\>if exist e:\ghost\system.gho set gho=e:

D:\>if exist f:\ghost\system.gho set gho=f:

From the result, there is no problem.
Floor8 哑巴 Posted 2004-04-11 00:00
初级用户 Posts 37 Credits 270
2003 and XP seem to be okay, but when replacing with DOS 8.0 and DOS 7.1, the value of %PIO% cannot be passed. Why is this???????
Floor9 willsort Posted 2004-04-13 00:00
元老会员 Posts 1,512 Credits 4,432
Re Yaba:

If you want to run normally under DOS 7/8 versions, change the drive separator in the %PIO% value to a semicolon, or it can also be an equal sign or a space, but not a comma, otherwise the for command cannot separate the individual drive letters.
Floor10 哑巴 Posted 2004-04-13 00:00
初级用户 Posts 37 Credits 270
willsort is a good comrade, why didn't I notice this!
The %LglDrv% in the 98 startup disk is a good example,
I remember that DOS622 seems to only use commas, I forgot after not using it for too long.
Floor11 willsort Posted 2004-04-14 00:00
元老会员 Posts 1,512 Credits 4,432
Re Y哑巴:

Among a series of versions of DOS, except for the virtual DOS console under the NT platform, all other versions support three command parameter separators, namely semicolons, equals signs, and spaces.

Spaces are more commonly used in command lines, semicolons are more commonly used in loop concentration in FOR statements, and equals signs are more commonly used in the internal command PATH. Except for extremely rare occasions, basically all internal commands are compatible with the three parameter separators, that is, in the use of internal commands, where spaces can be used, equals signs and semicolons can also be used, and the effects are equivalent.

The reason is that when command.com, as the unified manager of internal commands, handles the situation of parameter separation, in order to simply support the use in various occasions, it uniformly treats them as general separators. Of course, in external commands, their own parameter separation recognition mechanism is used, so there are no redundant separators other than spaces; and in some internal commands (such as set), equals signs and semicolons may have special interpretations, which are special exceptions.


Floor12 哑巴 Posted 2004-04-19 00:00
初级用户 Posts 37 Credits 270
This is easy to understand, thanks. I still have a small problem that hasn't been solved yet.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023