中国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-18 20:41
47,814 topics / 349,908 posts / today 1 new / 48,259 members
DOS疑难解答 & 问题讨论 (解答室) » What's wrong with this autoexec.bat?
Printable Version  2,107 / 26
Floor1 terse Posted 2007-04-20 07:43
银牌会员 Posts 946 Credits 2,404
Contents of autoexec.bat (fragment)
@ECHO OFF
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a
mem /c|tfind /i "TW">nul
if not errorlevel 1 goto mo
lh %ud%\dos\tw /np N3 >nul
:mo
SET DIRCMD=/OGN /4
SET PROMPT=$P$G
SET HDPMI=16384
SET RAMDRIVE=x:\
XMSDSK 20480 %RAMDRIVE% /y>NUL
PATH=%RAMDRIVE%;%ud%\;%ud%\dos;
COPY %ud%\dos\COMMAND.COM %RAMDRIVE%>NUL
SET COMSPEC=%RAMDRIVE%COMMAND.COM
MD %RAMDRIVE%TEMP
SET TEMP=%RAMDRIVE%TEMP
CD>%TEMP%\BOOTDRV.INI
vol>%TEMP%\VOL.TXT
cls
call w.bat box (+white on +blue) @%ud%\dos\dos.scr:start
if errorlevel 100 goto end
if errorlevel 4 goto re
if errorlevel 3 goto end
if errorlevel 2 goto wdos
menu..bat
Below is part of menu.bat:
IF EXIST %RAMDRIVE%dos\gho.bat goto gh
IF NOT EXIST %RAMDRIVE%unzip.exe copy %ud%\dos\unzip.exe %RAMDRIVE%unzip.exe
IF EXIST %ud%\dos\gho.ex_ copy %ud%\dos\gho.ex_ %RAMDRIVE%gho.zip>NUL
PATH=%PATH%;%RAMDRIVE%gho\;
%RAMDRIVE%
cd\
unzip -d gho.zip >nul
del gho.zip >nul
:gh
gho.bat

It stops when it gets to cd\ . At this point there is unzip and gho.zip in %RAMDRIVE%, but it just won't extract.

After extracting manually, the original PATH becomes invalid; it says file not found (the file is in %ud%\dos)
Floor2 lianjiang2004 Posted 2007-04-20 07:58
金牌会员 Posts 1,884 Credits 3,946
My level is limited, I can't see the problem either.
I don't see any directory in the virtual drive, so you might as well just remove cd\.
Floor3 terse Posted 2007-04-20 08:03
银牌会员 Posts 946 Credits 2,404
What gho.zip extracts to is a directory
Floor4 lianjiang2004 Posted 2007-04-20 08:57
金牌会员 Posts 1,884 Credits 3,946
The problem is that your cd\ is before the extraction.
Floor5 lianjiang2004 Posted 2007-04-20 08:58
金牌会员 Posts 1,884 Credits 3,946
del >nul
???
This line isn't right either, is it?
Floor6 0451lym Posted 2007-04-20 09:08
高级用户 Posts 357 Credits 760
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a

This is wrong here!
If you're checking the boot drive letter, I suggest using the volume label to determine it, that is, give your IMG a fixed volume label!

Or use CD>%TEMP%\BOOTDRV.INI to determine it.

[ Last edited by 0451lym on 2007-4-20 at 09:14 AM ]
Floor7 lianjiang2004 Posted 2007-04-20 09:29
金牌会员 Posts 1,884 Credits 3,946
Originally posted by 0451lym at 2007-4-20 09:08:
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a

This is wrong here!
If you're checking the boot drive letter, I suggest using the volume label to determine it, that is, give your IMG a fixed volume label!

Or use CD>%TEMP%\BOOTDRV.INI ...


Looks like it's for USB booting. If so, you can also put a marker file there.
Or do it like OneKey Ghost, and after booting run
vol >x:\vol.txt
Then use the line below to determine it
type vol.txt|find /i "drive C"
Floor8 terse Posted 2007-04-20 09:56
银牌会员 Posts 946 Credits 2,404
Originally posted by lianjiang2004 at 2007-4-20 08:57:
The problem is that your cd\ is before the extraction.

cd\ returns to the root directory, I should still continue extracting, right! Even without CD\, the problem is still there!
Originally posted by lianjiang2004 at 2007-4-20 08:58:
del >nul
???
This line isn't right either, is it?

It should be del gho.zip

Originally posted by 0451lym at 2007-4-20 09:08:
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a
This is wrong here!
If you're checking the boot drive letter, I suggest using the volume label to determine it, that is, give your IMG a fixed volume label!

Or use CD>%TEMP%\BOOTDRV.INI ...

Right now the problem is that it can work while in %ud% (that is, the USB boot directory)! After switching to %RAMDRIVE%, the PATH setting from the original AUTOEXEC becomes invalid! I had always used it this way before! It's only after trying MINITO and changing CONFIG.SYS a bit that now once I enter %RAMDRIVE% the original PATH no longer works, but when I go back to the USB drive it works again.
Could it be a COMMAND problem?
Floor9 0451lym Posted 2007-04-20 10:12
高级用户 Posts 357 Credits 760
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a
It should be like this:
FOR %%a IN (A: C:) DO IF EXIST %%a SET ud=%%a

But this result will always be %UB%=="C:"
Floor10 terse Posted 2007-04-20 10:16
银牌会员 Posts 946 Credits 2,404
Originally posted by 0451lym at 2007-4-20 10:12:
FOR %%a IN (A: C:) DO IF EXIST SET ud=%%a
It should be like this:
FOR %%a IN (A: C:) DO IF EXIST %%a SET ud=%%a

But this result will always be %UB%=="C:"

Thanks. But the root problem still hasn't been solved! So frustrating! I'll post CONFIG.SYS, take a look!
dos=high,umb,auto
device=\DOS\himem.sys /testmem:off
device=\dos\UMBPCI.SYS /I=D800-EFFF
device=\dos\jemm386.exe i=b000-b7ff noems
SHELL=\DOS\COMMAND.COM /P /F /E:4096
FCBSHIGH=4,0
FILESHIGH=30
BUFFERSHIGH=80,0
STACKSHIGH=9,256
LASTDRIVEHIGH=Z
Floor11 0451lym Posted 2007-04-20 10:23
高级用户 Posts 357 Credits 760
I can't see any problem!
I suggest pressing CTRL+F8 when entering DOS, and going through it step by step to see where the error is!
Then use SET to see which variable is wrong!
Floor12 terse Posted 2007-04-20 12:36
银牌会员 Posts 946 Credits 2,404
Originally posted by 0451lym at 2007-4-20 10:23:
I can't see any problem!
I suggest pressing CTRL+F8 when entering DOS, and going through it step by step to see where the error is!
Then use SET to see which variable is wrong!

DOS boots normally! And AUTOEXEC executes smoothly too; including the initial PATH=%UD% working, otherwise MENU.BAT couldn't possibly get as far as CD\! The MENU.BAT called from AUTOEXEC stops at cd\ and reports Batch file missing
If I manually extract it and then enter the %RAMDRIVE%gho directory to execute GHO.BAT, then because the PATH=%UD%;%UD%\DOS set earlier in AUTOEXEC is no longer valid at that time, it causes GHO.BAT in %RAMDRIVE%gho to fail to run, and it even hangs!!! I don't know whether it could be a file-related cause!
(And when I go back from %RAMDRIVE% to %UD%, PATH=%UD%;%UD%\DOS becomes effective again!)

[ Last edited by terse on 2007-4-20 at 12:38 PM ]
Floor13 0451lym Posted 2007-04-20 12:45
高级用户 Posts 357 Credits 760
I don't know if this is right either, but see whether this line is what causes the batch file missing message:
PATH=%PATH%;%RAMDRIVE%gho\;

Variables do have a certain length!
If it isn't a problem with the batch command itself, then consider it here.

[ Last edited by 0451lym on 2007-4-20 at 12:46 PM ]
Floor14 terse Posted 2007-04-20 22:41
银牌会员 Posts 946 Credits 2,404
Originally posted by 0451lym at 2007-4-20 12:45:
I don't know if this is right either, but see whether this line is what causes the batch file missing message:
PATH=%PATH%;%RAMDRIVE%gho\;

Variables do have a certain length!
If it isn't a problem with the batch command itself, then consider it here ...

The problem is here:
FOR %%a IN (A: C:) DO IF EXIST %%a SET ud=%%a

%ud% is empty. Why?
Floor15 BWSkyer Posted 2007-04-20 22:49
中级用户 Posts 180 Credits 367 From 重庆
Can A: C: be checked with if exist??

I don't think so. You can define a file here yourself to check, like A:\test.log c:\test.log. That should be fine...
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023