|
eech
高级用户
   
积分 906
发帖 346
注册 2006-7-10
状态 离线
|
『楼 主』:
求助:关于找不到批处理的提示
使用 LLM 解释/回答一下
C:\Documents and Settings\All Users\「开始」菜单\卸载IE多窗口插件.bat
内容如下:
----------------------------------
@ECHO off
echo 你确定要卸载IE多窗口插件吗?
echo 按任意键开始卸载!(会自动关闭IE窗口和资源管理器窗口)
pause>nul
attrib -s -h -r "%ALLUSERSPROFILE%\「开始」菜单\卸载IE多窗口插件.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
-----------------------------------
可正常运行,并生效,最后删除自身,只是运行到最后提示“找不到批处理文件”改了无数次,实在不知哪不对了,请好心人帮忙看看
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.
|
|
2007-5-31 23:30 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
去掉@echo off和del %0自己检查一下.
Remove @echo off and del %0, then check it yourself.
|
|
2007-6-1 00:37 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
看错^_^
我这里可以删除,只是不能在命令行运行这个目录的批处理,提示“找不到批处理文件”
试试:
del %0>nul 2>nul
Last edited by zh159 on 2007-6-1 at 10:57 AM ]
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 ]
|
|
2007-6-1 01:34 |
|
|
eech
高级用户
   
积分 906
发帖 346
注册 2006-7-10
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
不行啊,加了AH,还是提示找不到,
It doesn't work. After adding AH, it still prompts that it can't be found.
|
|
2007-6-1 10:46 |
|
|
ttyp
初级用户
 
积分 180
发帖 84
注册 2006-9-7
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
是不是因为有长目录或者带空格的目录还是中文目录?
Is it because there are long directories, directories with spaces, or Chinese directories?
|
|
2007-6-1 11:52 |
|
|
ttyp
初级用户
 
积分 180
发帖 84
注册 2006-9-7
状态 离线
|
|
2007-6-1 11:52 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by ttyp at 2007-6-1 11:52:
del "%0"
呢
直接使用%0会自带双引号
Originally posted by ttyp at 2007-6-1 11:52:
del "%0"
Well, using %0 directly comes with double quotes by itself
|
|
2007-6-1 11:57 |
|
|
eech
高级用户
   
积分 906
发帖 346
注册 2006-7-10
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
大家可以保存我的批处理文件试一下,无论怎么写都会提示找不到批处理文件,
错误提示:
WINDOWS找不到文件夹 /IDLIST:252:856,请确定文件名是否正确,再试一次,要搜索文件,请单击「开始」菜单按钮,然后单击"搜索"
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"
|
|
2007-6-1 12:27 |
|
|
eech
高级用户
   
积分 906
发帖 346
注册 2006-7-10
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by zh159 at 2007-6-1 01:34:
看错^_^
我这里可以删除,只是不能在命令行运行这个目录的批处理,提示“找不到批处理文件”
试试:
del %0>nul 2>nul
Last edited by zh159 on 2007-6-1 at 10:57 AM ]
早加过了,还是有错误提示
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
|
|
2007-6-1 12:28 |
|
|
dikex
高级用户
    潜水修练批处理
积分 788
发帖 366
注册 2006-12-31
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我这里运行正常,运行后可以自行退出并删除自身
It runs normally here, and after running, it can exit by itself and delete itself.
|

正在潜水修练的批处理小白 |
|
2007-6-1 13:10 |
|
|
eech
高级用户
   
积分 906
发帖 346
注册 2006-7-10
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by dikex at 2007-6-1 13:10:
我这里运行正常,运行后可以自行退出并删除自身
我也是可以的,但如果你仔细看,最后会有一句,找不到批处理的提示,虽不影响使用,但我想找出原因
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.
|
|
2007-6-1 13:29 |
|
|
dikex
高级用户
    潜水修练批处理
积分 788
发帖 366
注册 2006-12-31
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
先做一个试验,写一个批处理,内容为
@echo off
pause
echo a
pause
运行后先不要按任何键,在那个批处理上面右键——编辑,将echo a改为echo b,保存后转为那个正在运行的批处理的窗口,按一下任意键,结果echo出来的是b而不是a!
再做一个试验,批处理内容如下:
@echo off
pause
echo a
pause
同样运行后不要按任何键,然后把那个批处理文件删除或者重命名,接着转为批处理的运行窗口,按一下任意键,批处理直接退出而不执行下面的语句,隐约看到一行报错的语句;
关于这个,以下为个人猜测:
批处理运行时并不会一开始就将所有的代码载入内存,而是每执行完一行才载入下一行的代码,于是我们就产生了试验里面中途改变代码后执行的是修改后的代码;
具体到楼主的那个批处理,由于批处理在运行时把自身删除了,在执行完那个del的命令后系统想往下读取下一行命令时却发现找不到那个批处理文件,于是就报错了。
Last edited by dikex on 2007-6-1 at 02:04 PM ]
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 ]
|

正在潜水修练的批处理小白 |
|
2007-6-1 13:59 |
|
|
dikex
高级用户
    潜水修练批处理
积分 788
发帖 366
注册 2006-12-31
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
使用cmd /k来调用那个试验批处理,结果比较容易观测
Use cmd /k to call that test batch file, and the results are easier to observe
|

正在潜水修练的批处理小白 |
|
2007-6-1 14:07 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
@echo off
echo hello
del %0
@echo off
echo hello
del "%0"
@echo off
echo hello
del %0>nul 2>nul
网上有人说del %0后面不能加回车,但是经我测试,以上三段代码无论怎样改都会报错,跟楼主一样。
我的测试环境XP SP2
等待高人出现
```
@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
|
|
2007-6-1 20:12 |
|
|
48344620
初级用户
 
积分 52
发帖 27
注册 2006-10-27
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
同意12楼的说法,我也测试了一下,和14楼的结果一样。
Agree with the statement of floor 12. I also tested it and got the same result as floor 14.
|
|
2007-6-1 21:38 |
|