运行powershell脚本时,如何使.bat文件不退出?
我将此代码放入.bat脚本以运行文件:运行powershell脚本时,如何使.bat文件不退出?,powershell,batch-file,Powershell,Batch File,我将此代码放入.bat脚本以运行文件: powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1" 脚本完成后,窗口关闭,我看不到输出。如何使窗口保持打开状态?取决于您希望在窗口中留下什么。是否需要命令提示符?如果是,请使用: cmd /k powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1 你想要一个powershell窗口吗 powershell -NoExit -NoP
powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1"
脚本完成后,窗口关闭,我看不到输出。如何使窗口保持打开状态?取决于您希望在窗口中留下什么。是否需要命令提示符?如果是,请使用:
cmd /k powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1
你想要一个powershell窗口吗
powershell -NoExit -NoProfile -ExecutionPolicy Bypass .\abc.ps1
直接在PowerShell中运行脚本。那么您就不需要批处理文件了。为什么要在cmd中运行PS脚本呢?我想在新行中添加
pause
。我猜在批处理文件中运行它的目的是控制执行策略,而无需在机器上预先设置它。