我有一堆运行 Windows 2000 Pro 和 IE 5.0 的旧机器,我想将它们升级到带有 Silverlight 的 IE 6。我从微软的网站下载了 IE6 和 Silverlight 安装程序,幸运的是它们都有命令行选项,允许它们在“静默模式”下运行。
我将这两个命令放入 DOS 批处理脚本中并运行它,但 IE6 安装程序需要自动重新启动计算机,因此问题是如何恢复脚本并运行第二个命令(安装 Silverlight)。
我的批处理文件现在非常简单:
ie6setup.exe /Q
silverlight.exe /q
据我所知,批处理文件在重新启动计算机后无法恢复执行。有没有办法让他们这样做?还有另一种方法可以完成我的需要吗?
谢谢
基于蒂姆的帖子,在测试时,将“two”附加到批处理文件,导致找不到批处理标签“onetwo”,因此修改为从单独的文本文件中读取和写入“当前”变量,留下批处理文件未受影响;
@echo off
call :Resume
goto %current%
goto :eof
:one
::Add script to Run key
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v %~n0 /d %~dpnx0 /f
echo two >%~dp0current.txt
echo -- Section one --
pause
shutdown -r -t 0
goto :eof
:two
echo three >%~dp0current.txt
echo -- Section two --
pause
shutdown -r -t 0
goto :eof
:three
::Remove script from Run key
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v %~n0 /f
del %~dp0current.txt
echo -- Section three --
pause
goto :eof
:resume
if exist %~dp0current.txt (
set /p current=<%~dp0current.txt
) else (
set current=one
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)