China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-01 05:57
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » Please help experts to take a look at the batch processing problem running under DOS! View 2,500 Replies 17
Original Poster Posted 2007-02-01 08:30 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
There is a GHOST batch script in the GHO directory of my USB flash drive. There is a section of code that selects the drive letter and then searches for GHO files. When I manually run the GHOST batch script in the USB flash drive's GHO directory, after not finding the GHO files, it automatically returns to the selection interface. But if I CALL and run the GHOST batch script in the GHO directory from the MENU.bat file in the root directory of the USB flash drive, when it doesn't find the GHO files, an empty file selection comes out. That's not what I want. I want to return to the selection interface if no GHO files are found! The above picture is the selection interface, and the following one is the one that shouldn't come out. I want to go back to the above picture interface if no GHO files are searched! When running in the GHO directory, the following picture is the same as the above one!

[ Last edited by terse on 2007-2-1 at 08:37 AM ]
Floor 2 Posted 2007-02-01 22:31 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
It looks like it's a menu made with wbat. You directly call the batch file from the upper directory. It's possible that the temporary files needed by the target batch file are not in the required directory. Take a look at how the other party's batch file is written. This definitely belongs to a problem in batch file writing. The only difference between the two running situations is the current directory.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2007-02-02 04:54 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
Yes, it's made with wbat for the menu. As for the directory issue, I think it's just the TEMP directory. I created one in the root directory of the USB drive and it didn't work! (Using cd gho is normal)
I'll paste that search code and have a look. I always come across Climbing's help. You must be the one on the Time and Space Forum too. Thanks!
:rec2
echo :d_list " 选择备份文件的所在盘 "[x]>%temp%\tmp.txt
func -a9 >>%temp%\tmp.txt
call w.bat list (+white on +blue) @%temp%\tmp.txt:d_list
if errorlevel 100 goto rec1
if "%wbat%"=="" goto rec1
set gpath=%wbat%:\

echo 正在搜索 %gpath% 备份文件 ...
echo :m_dir " 选择需要恢复的备份文件 " [x]>%temp%\tmp.txt
dir %gpath%ghost\*.gho /b /s >>%temp%\tmp.txt
call w.bat list (+white on +blue) @%temp%\tmp.txt:m_dir
if errorlevel 100 goto rec2
if "%wbat%"=="" goto rec2
set gfile=%wbat%
Floor 4 Posted 2007-02-05 02:03 ·  中国 江苏 常州 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
Seek expert help. Thanks!
Floor 5 Posted 2007-02-05 12:09 ·  中国 河南 开封 教育网
中级用户
★★
Credits 214
Posts 94
Joined 2007-01-11 10:39
19-year member
UID 76165
Gender Male
Status Offline
func -a9 >>%temp%\tmp.txt
Can all drive letters be obtained?
Not bad. Can you share the FUNC program or batch?
Floor 6 Posted 2007-02-05 12:26 ·  中国 河南 开封 教育网
中级用户
★★
Credits 214
Posts 94
Joined 2007-01-11 10:39
19-year member
UID 76165
Gender Male
Status Offline
Oh, I have some doubts about the practicality of this batch processing for automatically searching.GHO.

1. Now it's estimated that few people still use FAT32. To implement this batch processing, you need to load NTFSDOS, generate the necessary information files and then exit NTFSDOS. NTFSDOS has very poor support for Chinese. If there are Chinese characters in the path... IFSDRV has good support for Chinese, but I used the modified version by Elder Wen. If you read data from the NTFS partition, it can't exit normally.

2. Generally, backup files have the hidden attribute. DIR /S can search for hidden attribute files, but unfortunately, if the file is in a hidden directory, it can't be found. So in this way, the practicality is greatly reduced.

Of course, if someone says that I just use FAT32 or use English paths and filenames when using NTFS and don't hide backup files, then it's fine.

I'm sorry to go off - topic here, heh heh. It's just that I'm also planning to make a boot disk, including the standalone GHOST batch processing, the network GHOST batch processing with loaded network card drivers, etc. In the end, after thinking it over, I gave up the full - disk search function.
Floor 7 Posted 2007-02-05 13:55 ·  中国 江苏 常州 溧阳市 电信
银牌会员
★★★
Credits 2,404
Posts 946
Joined 2005-09-08 13:44
20-year member
UID 42345
Status Offline
Originally posted by llztt1 at 2007-2-5 12:09:
func -a9 >>%temp%\tmp.txt
Can it get all drive letters??
Not bad, can you share the FUNC program or batch?

http://terse.ys168.com/
Can't upload here. I uploaded it there.

RE: llztt1
No other uses, just like to tinker around. I look at it when I'm free at work. I don't fix machines for others. Sometimes I take a look at friends' machines. Hehe! Hope you can take a look after you make it? How about that?

[ Last edited by terse on 2007-2-5 at 02:00 PM ]
Floor 8 Posted 2007-02-05 14:52 ·  中国 河南 开封 教育网
中级用户
★★
Credits 214
Posts 94
Joined 2007-01-11 10:39
19-year member
UID 76165
Gender Male
Status Offline
回头修改一下MAXDOS的BAT,MAXDOS做的不错了,修改一下更合理些,譬如单机GHOST、PACKT网卡驱动》》生成WATTCP文件》》生成GHOST命令行》》选择GHOST版本启动GHOST,再做几个调用这些BAT的BAT,譬如实现无选择界面按默认参数运行。。
哈哈,你发的这个FUNC真如其名功能够多。。

Usage:FUNC <option>
PKMASTER 2003-03-14 Email:bootcd@163.com
Option:
These functions returns errorlevel 1~26 (count) or 255 (error):
-a<style> style=6 or 9 ; Print Drives Letters

These functions returns errorlevel 0 (succeed) or 255 (failed):
-e[drive] drive=A to Z ; Eject CDROM drive (Default first CDROM)
-l[drive] drive=A to Z ; Load CDROM drive (Default first CDROM)
-x[drive] drive=A to Z ; Auto Eject/Load CDROM (Default first CDROM)
-j Find MENU.INI in CDROM Drives
-v Reset video mode to 80x25 normal text mode
-m Initialize mouse and set cursor in the center of screen
-n Initialize mouse and set cursor in the (0,0) of screen
-r Reboot computer
-s Shutdown computer

These functions returns errorlevel 0 (true) or 100 (false):
-d<drive> drive=A to Z ; Check whether the drive is a CDROM or not
-i<var> Check whether the var(MaxLen=8) is a numeric or not
-f<var> Check whether the var(MaxLen=8) is a correct filename or not
-w<seconds> seconds=0 to 9999 ; Wait some seconds. Returns keycode
?<string> Print string without newline
Go back and modify the BAT of MAXDOS. MAXDOS has done a good job, and it can be modified to be more reasonable. For example, single-machine GHOST, PACKT network card driver >> generate WATTCP file >> generate GHOST command line >> select GHOST version to start GHOST, and make a few more BATS that call these BATS, such as realizing running with default parameters without the selection interface..
Haha, the FUNC you sent is really as its name implies, with many functions..

Usage: FUNC <option>
PKMASTER 2003-03-14 Email:bootcd@163.com
Option:
These functions return errorlevel 1~26 (count) or 255 (error):
-a<style> style=6 or 9 ; Print Drives Letters

These functions return errorlevel 0 (succeed) or 255 (failed):
-e[drive] drive=A to Z ; Eject CDROM drive (Default first CDROM)
-l[drive] drive=A to Z ; Load CDROM drive (Default first CDROM)
-x[drive] drive=A to Z ; Auto Eject/Load CDROM (Default first CDROM)
-j Find MENU.INI in CDROM Drives
-v Reset video mode to 80x25 normal text mode
-m Initialize mouse and set cursor in the center of screen
-n Initialize mouse and set cursor in the (0,0) of screen
-r Reboot computer
-s Shutdown computer

These functions return errorlevel 0 (true) or 100 (false):
-d<drive> drive=A to Z ; Check whether the drive is a CDROM or not
-i<var> Check whether the var(MaxLen=8) is a numeric or not
-f<var> Check whether the var(MaxLen=8) is a correct filename or not
-w<seconds> seconds=0 to 9999 ; Wait some seconds. Returns keycode
?<string> Print string without newline
Floor 9 Posted 2007-02-06 10:54 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
Originally posted by llztt1 at 2007-2-5 12:26:
Oh, I have some doubts about the practicality of this batch processing that automatically searches for.GHO.
...


Hehe, why?
Your doubt is not incorrect, but I spent a lot of thought three months ago, thought of many methods, and now I can already search the entire disk automatically and restore the entire disk automatically (no matter what NTFS is)!

But I won't release my code. It's quite simple...

1. Must automatically search multiple hard drives
2. Must be able to be converted to the form of X:Y\
Floor 10 Posted 2007-02-06 11:40 ·  中国 河南 开封 教育网
中级用户
★★
Credits 214
Posts 94
Joined 2007-01-11 10:39
19-year member
UID 76165
Gender Male
Status Offline
Hehe,I'm willing to hear the details. Why not go into more depth?
1. What specific search command did you use, DIR /S? If so, how to solve the problem of searching for hidden files in hidden directories? Also, which driver command is used for DOS to access the NTFS partition?
2. The X:Y\ form, what is it aimed at? Hehe, I don't understand.

Considering from another angle, for example, when we search for a certain file in WINDOWS, if there is a lot of hard disk data, the search time can be long. It's normal to encounter a search taking 10 minutes.
Floor 11 Posted 2007-02-06 12:00 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
Originally posted by llztt1 at 2007-2-6 11:40:
Hehe, I'd like to hear the details. Why don't you go into more depth?
1、What specific search command did you use, DIR /S? If so, how to solve the problem of searching for hidden files in hidden directories? Also, DO...


Hehe, the first point uses an external command DIRT, which can solve your first problem.
The second point is the key.

Change the drive letter to the form recognized by GHOST, such as 1:2 or 1:4 or 2:1!
Since the NT driver can be mounted to find the file, then it's easy! (Don't unmount the NT driver in the middle)
For example:
The found file is C:\A.GHO
Then you can use another external command to tentatively find 1.2:\A.GHO
If not found, then find 1.3:\A.GHO, etc.
Once found, you can use the variable introduction command to execute it!


Find the second command yourself; old athletes all know what command it is!
Floor 12 Posted 2007-02-06 12:05 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
Because DIRT can set the depth of the search directory, so time can be limited. Generally, the image files are not placed below the second-level directory (there are exceptions for a few people). Therefore, time is not an issue. Moreover, variables can be set to modify the number of layers of the search directory, so the default is a quick search, and then a few people can modify the deep directory for their own search!
Ah, it's like a tongue twister! Hehe
Floor 13 Posted 2007-02-06 12:07 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
:AUTOEXEC " My Image Recovery System → 06.12.03"

※※※※※※※※※※※※※※※※※※※※※※
※ ※
※ [! Load CD-ROM Driver ] ※
※ ※
※ [! Load ^NTFS Driver ] ※
※ ※
※※※※※※※※※※※※※※※※※※※※※※

"TAB" key = jump "Spacebar" = select "Esc" key = refresh

[Y → System Desktop←] [N → DOS Command Line←]

::
:BF_0 " My Image Recovery System → Backup %FQ% Disk!" [x]


[X Wizard]

Hard disk %S1% → Partition %S2%

Backup to

Hard disk [$D1,1] → Partition [$D2,1]


Warning: "Confirm immediate backup" will overwrite the same-named image backup and cannot be restored!
___________________________________________________________

"TAB" key = jump "F1~F2" = overwrite "←" key = delete

[ Y → Confirm immediate backup← ] [? Esc→ Return to System Desktop← ]

::
:BF_1 " My Image Recovery System → Backup %FQ% Disk → Wizard Ⅰ" [x]


Image backup to

[ A. Hard disk 1 ] [ B. Hard disk 2 ]

[ Partition &1 ] [ Partition &2 ] [ Partition &3 ]

[ Partition &4 ] [ Partition &5 ] [ Partition &6 ]

Tip: Image backup to hard disk %D1% → partition %D2%! [S. Manual setting]
___________________________________________________________

[ F → Return to upper menu← ] [? Esc→ Return to System Desktop← ]

::
:BF_2 " My Image Recovery System → Backup %FQ% Disk → Wizard Ⅱ" [x]


Confirm %FQ% disk location

[ A. Hard disk 1 ] [ B. Hard disk 2 ]

[ Partition &1 ] [ Partition &2 ] [ Partition &3 ]

Tip: Hard disk %S1% → partition %S2% is %FQ% disk!

Tip: Image backup to hard disk %D1% → partition %D2%! [Y. Confirm change]
___________________________________________________________

[ F → Return to upper menu← ] [? Esc→ Return to System Desktop← ]

::
:GJBF_0 " My Image Recovery System → Advanced Backup!" [x]

Hard disk [$S1,1] partition [$S2,1]

Backup to

Hard disk [$D1,1] partition [$D2,1]:\[$WJ,30,U, ].gho [ ※Show default name ]

If filling in the image name, it must comply with the 8.3 format, and pay attention to whether the image path exists!
____________________________________________________________

Compression: [$YS,1] level (Low compression, fast 1↓~~↑9 high compression, slow speed)

Volume: [$FJ,4,U,] MB ("0" means no volume, CD burning image is recommended to be "600" MB)

[ ※Fill in password protection ] Password: (%M%) [ ※Cancel password protection ]

Warning: "Confirm immediate backup" will overwrite the same-named image backup and cannot be restored!
____________________________________________________________

TAB key = jump F1~F2 = overwrite "←" key = delete

[ Y → Confirm immediate backup← ] [? Esc→ Return to System Desktop← ]

::
:GJBF_1 " Fill in password protection"[x]

Enter password: [$MM,10,P! ]

Confirm password: [$MM1,10,P! ]

Tip: 1. Alt+F2 = Pinyin input.
Alt+F6 = English input.

2. Up to 10 characters are allowed.

3. ESC key = Cancel password protection.

[ ※Confirm ]

::
:GJBF_2 " Password error !"[x]

Passwords do not match twice!

[ Confirm ]

::
:HF_0 " My Image Recovery System → Restore %FQ% Disk!" [x]


I want to restore

Hard disk %S1% → Partition %S2%

[X Select image]

Hard disk [$D1,1] → Partition [$D2,1]: [$WJ,30,U, ].gho


Warning: Please handle important data on the system by yourself. After image restoration, the system will be archived!
___________________________________________________________

"TAB" key = jump "F1~F2" = overwrite "←" key = delete

[ Y → Confirm immediate restore← ] [? Esc→ Return to System Desktop← ]

::
:HF_1 " My Image Recovery System → Restore %FQ% Disk → Select image" [x]


Please select the image by number
__________________

[ 1]%WJ1%
[ 2]%WJ2%
[ 3]%WJ3%
[ 4]%WJ4%
[ 5]%WJ5%
[ 6]%WJ6%
[ 7]%WJ7%
[ 8]%WJ8%
[ 9]%WJ9%
[1&0]%WJ10%

Tip: After loading the NTFS driver, NTFS partition search is supported!
___________________________________________________________


[ F → Return to upper menu← ] [? Esc→ Return to System Desktop← ]

::
:HF_2 " My Image Recovery System → Restore %FQ% Disk!" [x]


"%WJ%"

Restore to

Hard disk %S1% → Partition %S2%


Warning: Please handle important data on the system by yourself. After image restoration, the system will be archived!
___________________________________________________________

"Esc"=Return to System Desktop

[ F → Return to upper menu← ] [ Y → Confirm immediate restore← ]

::
:HF_3 " Image search result!"[x]

No GHO image found!

[ Confirm ]
Floor 14 Posted 2007-02-06 12:11 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
This is part of mine, you can see it and know that I'm not lying. I can't write out so much right now! So, think more about it, think more! Why I don't release the code is because none of the current GHOST recovery software has this function, hehe! The joy of harvest is still left to those who think more!)
Floor 15 Posted 2007-02-06 13:56 ·  中国 河南 开封 教育网
中级用户
★★
Credits 214
Posts 94
Joined 2007-01-11 10:39
19-year member
UID 76165
Gender Male
Status Offline
I tried DIRT, which is quite powerful. It can search Chinese directories, hide files in hidden directories, and with the function of limiting the depth of searching subdirectories, it's really awesome.

The person above likes to use their brains for research. I wonder if you're interested in integrating BART's network boot disk into 7.1. BART's disk uses his template, and that batch processing is really difficult. I'm looking at MAXDOS's network disk imaging disk, but MAXDOS has 3 network card drivers restricted in CONFIG.SYS when loading, which isn't cool. BART's disk has no such restrictions, and automatically loading the network card driver + generating the necessary files for MSNET are all done in the batch processing.

If we can simply add a directory and batch processing that integrates multiple network card drivers, and then can realize automatic loading of the network card driver through this batch processing in pure DOS, that would be great.
Forum Jump: