时间:2010-07-26 02:47:30

标签: windows internet-explorer-6 administration

4 个答案:

答案 0 :(得分:4)

基于Tim的帖子,在测试时,将“两个”附加到批处理文件中,导致无法找到批处理标签“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
)

答案 1 :(得分:3)

答案 2 :(得分:1)

答案 3 :(得分:0)

我知道它有点陈旧,但这很有效:

@echo off
call :Resume
goto %current%
goto :eof

:one
echo two >>myfile.cmd
::REBOOT HERE
goto :eof

:two
echo resumed here
goto :eof

:resume
rem THIS PART SHOULD BE AT THE BOTTOM OF THE FILE
set current=one