重新启动计算机后恢复批处理脚本

del*_*ave 2 windows administration internet-explorer-6

我有一堆运行Windows 2000 Pro和IE 5.0的旧机器,我想使用Silverlight升级到IE 6。我从微软的网站上下载了IE6和Silverlight安装程序,幸运的是,它们都具有命令行选项,可以在“静默模式”下运行。

我将这两个命令放入DOS批处理脚本中并运行了,但是IE6安装程序要求计算机自动重启,因此问题是如何恢复脚本并运行第二个命令(安装Silverlight)。

我的批处理文件现在非常简单:

ie6setup.exe /Q
silverlight.exe /q
Run Code Online (Sandbox Code Playgroud)

据我了解,重新启动计算机后批处理文件无法恢复执行。有没有办法让他们做到这一点?的另一种方式来完成我需要的。

谢谢

Val*_*nte 5

基于Tim的帖子,该帖子经过测试,在批处理文件中附加了“两个”,导致找不到批处理标签“ onetwo”,因此修改为从单独的文本文件中读取和写入“ current”变量,从而保留了该批处理文件未更改;

@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
)
Run Code Online (Sandbox Code Playgroud)