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-08-05 05:44
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help: About the prompt of not finding the batch processing View 2,120 Replies 15
Original Poster Posted 2007-05-31 23:30 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
C:\Documents and Settings\All Users\「Start」Menu\Uninstall IE Multi-Window Plug-in.bat

The content is as follows:
----------------------------------
@ECHO off
echo Are you sure you want to uninstall the IE multi-window plug-in?
echo Press any key to start the uninstallation! (It will automatically close IE windows and Explorer windows)
pause>nul
attrib -s -h -r "%ALLUSERSPROFILE%\「Start」Menu\Uninstall IE Multi-Window Plug-in.bat"
taskkill /f /im iexplore.exe>nul 2>nul
taskkill /f /im explorer.exe>nul 2>nul
regsvr32 /u /s %windir%\system32\WebTools.dll
del %windir%\system32\Help.gif
del %windir%\system32\settings.gif
del %windir%\system32\license.dat
del %windir%\system32\WebTools.dll
del %windir%\system32\WebToolshelp.htm
del %windir%\system32\WebToolssettings.htm
reg delete "HKEY_CURRENT_USER\Software\Microgarden\WebTools" /f
start explorer.exe
start ...
del %0
-----------------------------------
It can run normally and take effect, and finally delete itself. It's just that it prompts "Batch file not found" at the end. I've changed it countless times and really don't know what's wrong. Please help me take a look.
Floor 2 Posted 2007-06-01 00:37 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Remove @echo off and del %0, then check it yourself.
Floor 3 Posted 2007-06-01 01:34 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Mistakenly ^_^

I can delete here, but I can't run the batch file in this directory in the command line, prompting "Batch file not found"

Try:
del %0>nul 2>nul

[ Last edited by zh159 on 2007-6-1 at 10:57 AM ]
Floor 4 Posted 2007-06-01 10:46 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
It doesn't work. After adding AH, it still prompts that it can't be found.
Floor 5 Posted 2007-06-01 11:52 ·  中国 上海 电信
初级用户
★★
Credits 180
Posts 84
Joined 2006-09-07 00:33
19-year member
UID 61995
Status Offline
Is it because there are long directories, directories with spaces, or Chinese directories?
Floor 6 Posted 2007-06-01 11:52 ·  中国 上海 电信
初级用户
★★
Credits 180
Posts 84
Joined 2006-09-07 00:33
19-year member
UID 61995
Status Offline
Floor 7 Posted 2007-06-01 11:57 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by ttyp at 2007-6-1 11:52:
del "%0"
Well, using %0 directly comes with double quotes by itself
Floor 8 Posted 2007-06-01 12:27 ·  中国 广西 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Everyone can save my batch file and try it. No matter how I write it, it will prompt that the batch file is not found.

Error message:

WINDOWS cannot find the folder /IDLIST:252:856. Please confirm whether the file name is correct and try again. To search for the file, click the "Start" menu button and then click "Search"
Floor 9 Posted 2007-06-01 12:28 ·  中国 广西 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Originally posted by zh159 at 2007-6-1 01:34:
Misread ^_^

I can delete here, but I can't run the batch file in this directory from the command line, and it prompts "Batch file not found"

Try:
del %0>nul 2>nul

[ Last edited by zh159 on 2007-6-1 at 10:57 AM ]


I've already added it, but there are still error messages
Floor 10 Posted 2007-06-01 13:10 ·  中国 广东 广州 白云区 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
It runs normally here, and after running, it can exit by itself and delete itself.
正在潜水修练的批处理小白
Floor 11 Posted 2007-06-01 13:29 ·  中国 广西 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Originally posted by dikex at 2007-6-1 13:10:
It runs normally here. After running, it can exit by itself and delete itself.


I can too, but if you look closely, there will be a last sentence, a prompt that the batch file is not found. Although it doesn't affect the use, I want to find out the reason.
Floor 12 Posted 2007-06-01 13:59 ·  中国 广东 广州 白云区 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
First, do an experiment. Write a batch script with the content:

@echo off
pause
echo a
pause


After running, don't press any key immediately. Right-click on that batch script and select "Edit". Change "echo a" to "echo b", save it, then switch back to the running batch window and press any key. The result is that "b" is echoed instead of "a"!

Do another experiment. The batch script content is as follows:

@echo off
pause
echo a
pause


Similarly, after running, don't press any key. Then delete or rename that batch file. Then switch back to the batch running window and press any key. The batch directly exits without executing the following statements, and a line of error message is vaguely seen;

Regarding this, the following is a personal guess:

When a batch script runs, it doesn't load all the code into memory at the beginning. Instead, it loads the next line of code only after executing the current line. So we have the situation in the experiment where modifying the code midway results in executing the modified code;

Specifically for the original poster's batch script, because the batch script deletes itself during execution. After executing the "del" command, when the system tries to read the next line of commands downward, it finds that the batch file is not found, so an error occurs.

[ Last edited by dikex on 2007-6-1 at 02:04 PM ]
正在潜水修练的批处理小白
Floor 13 Posted 2007-06-01 14:07 ·  中国 广东 广州 白云区 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
Use cmd /k to call that test batch file, and the results are easier to observe
正在潜水修练的批处理小白
Floor 14 Posted 2007-06-01 20:12 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
```
@echo off
echo hello
del %0
```

```
@echo off
echo hello
del "%0"
```

```
@echo off
echo hello
del %0>nul 2>nul
```
Some people online say that you can't add a carriage return after del %0, but after my testing, no matter how I change the above three segments of code, it will report an error, the same as the building owner.
My test environment is XP SP2
Waiting for experts to appear
Floor 15 Posted 2007-06-01 21:38 ·  中国 吉林 长春 电信
初级用户
Credits 52
Posts 27
Joined 2006-10-27 16:42
19-year member
UID 68509
Gender Male
Status Offline
Agree with the statement of floor 12. I also tested it and got the same result as floor 14.
Forum Jump: