summaryrefslogtreecommitdiffstats
path: root/answerfiles/nextscript.cmd.in
blob: 531e0b4db88ecfe937fb863aa531a7291d098e95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
rem echo in %0
set next=%1
set reboot=%~2
set max=99
set nextscript=
echo off
for /L %%i in (%next%,1,%max%) do (
    if EXIST @SETUP_PATH@\setupscript%%i.cmd (
        set nextscript=@SETUP_PATH@\setupscript%%i.cmd
        set idx=%%i
        goto runscript
    )
)
echo on
echo No more scripts

:runscript
echo on
if DEFINED reboot (
    if DEFINED nextscript (
        rem echo setup runonce for %nextscript%
        reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce /v SetupPass%idx% /t REG_SZ /d "cmd /c %nextscript% > c:\setuppass%idx%.log 2>&1"
    )
    echo %reboot%
    shutdown -r -f -t 60 -c "Shutting down in 1 minute %reboot%"
    rem echo reboot in 1 minute
) else (
    if DEFINED nextscript (
        rem no reboot - just call the next script
        echo run %nextscript%
        call %nextscript% > c:\setuppass%idx%.log 2>&1
    )
)