如何在批处理脚本中运行Powershell脚本和批处理脚本?

最大限度

我有一个名为oneclick.bat的控制器批处理文件,代码如下:

rem batch controller
rem wait for email input for ssh key generation...
rem call copyEnv.bat
call generateSshKey.bat %1
call gitClone.bat

在generateSshKey.bat中,我启动一个powershell脚本,如下所示:

rem make sure powershell is able to run 
powershell.exe  set-executionpolicy remotesigned

rem start powershell and add ssh key to the server by ui aotumation
powershell.exe -noe -file SetSSHKeytoServer.ps1

然后gitClone.bat没有在命令窗口中运行

我如何才能运行gitClone.bat?

安斯加·威彻斯

当您想返回到调用脚本时,不应使用带有阻止脚本返回的选项来运行PowerShell。-noe从的最后一行删除generateSshKey.bat

-NoExit
    Does not exit after running startup commands.

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章