2014-11-24 168 views
0

我有2批处理脚本。 这是第一个:如何在重新启动后运行批处理脚本?

pushd \\ta1bbn01\Public\Migration\ 
     %CD%\uninstallLogs\rationaluninstalltool.exe %CD%\uninstallLogs 
     \\%COMPUTERNAME%-%USERNAME%.log -c -nr 

    popd 

第一个是卸载软件,然后重新启动计算机。重启后,我想运行我的第二个脚本,它将安装一个新软件。 我应该在我的第一个脚本中输入什么内容才能将其添加到下一次启动中,我只需要在下次启动时使用它。 如何在30秒内延迟运行它,以确保所有其他服务都可以运行?

+4

这里有'RunOnce'注册表项:http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx – 2014-11-24 14:23:42

回答

0

放在批次上的启动文件夹..让我们假设你的批次下的test.bat ..把它的启动文件夹

在批结束后,检查如果一切顺利的权利,然后删除test.bat

@echo off 
REM // all your installation logic 
REM // if something went wrong exit .. 
REM // we have finished what we want so we will delete the batch from the startup 
del test.bat 
@echo on 

我希望这可以帮助。

+0

什么是路径安装文件夹?如果是的话,是否有任何方法可以与注册表做到这一点,请给我一些代码示例。 – user3502786 2014-11-24 17:53:02

+0

检查此问题http://stackoverflow.com/questions/17714652/how-to-set-value-in-registry-via-batch-file-in-windows – 2014-11-25 08:39:24

相关问题