无提示安装Windows 7时,startnet.cmd会出现问题

时间:2011-12-08 09:53:14

标签: windows

我正在尝试使用startnet.cmd文件无人值守地启动Windows 7。问题是,当触发启动setup.exe命令时,安装程​​序会运行并关闭,但由于startnet.cmd仍处于打开状态,因此无法重新启动。如果我放“退出”,它会启动设置并立即退出。有没有办法检查设置是否成功运行然后执行退出?

wpeinit
net use u: \\192.168.2.10\windows
u:
start setup.exe /unattend:\\192.168.2.10\windows\unattend.xml /noreboot
REM ping -n 30 127.0.0.1
REM exit

1 个答案:

答案 0 :(得分:3)

我认为您的命令是正确的,但您明确指出setup.exe在设置过程的第一阶段完成后不会启动重启。

在设置过程中,黑色cmd.exe窗口必须保持打开状态。如果终止,则Windows PE立即重启。因此您的setup.exe进程将被终止。我认为你的评论使用ping来很好地延迟退出表明你已经尝试延迟终止shell进程。但是,由于您无法知道设置过程需要多长时间,因此无法在延迟算法中填写任何有用的值。

虽然我认为你不需要。您正在使用setup.exe启动start,它会分离进程并立即返回到shell。事实上,由于setup.exe是您运行的最后一个命令,因此您也可以使用setup.exe未分离的事实。不使用start或使用start /wait

wpeinit
net use u: \\192.168.2.10\windows
u:
setup.exe /unattend:\\192.168.2.10\windows\unattend.xml /noreboot
exit

wpeinit
net use u: \\192.168.2.10\windows
u:
start /wait setup.exe /unattend:\\192.168.2.10\windows\unattend.xml /noreboot
exit

虽然我认为这样做的全部目的是返回shell并在exit终止后执行setup.exe(启动重启)命令。

由于没有更多命令要执行,我建议让setup.exe通过删除/noreboot标志来重启:

wpeinit
net use u: \\192.168.2.10\windows
u:
start setup.exe /unattend:\\192.168.2.10\windows\unattend.xml

这应该在安装程序运行时保持shell进程(cmd.exe)打开。在设置过程结束时,它将启动重新启动(由setup.exe启动),因此也会启动