【发布时间】:2023-03-25 08:04:01
【问题描述】:
我想通过批处理执行 .ps1 文件后自动关闭命令行窗口。 (批处理有效,但执行后窗口没有关闭/消失)
这是批次:
cd C:\
powershell.exe -noexit "& C:\Users\user1\Desktop\Test.ps1"
exit
我需要更改或添加什么?
【问题讨论】:
-
嗯...删除
-noexit怎么样?
标签: batch-file cmd
我想通过批处理执行 .ps1 文件后自动关闭命令行窗口。 (批处理有效,但执行后窗口没有关闭/消失)
这是批次:
cd C:\
powershell.exe -noexit "& C:\Users\user1\Desktop\Test.ps1"
exit
我需要更改或添加什么?
【问题讨论】:
-noexit怎么样?
标签: batch-file cmd
使用start 命令解决您的问题。
代码:
start "" powershell.exe -noexit "& C:\Users\user1\Desktop\Test.ps1"
【讨论】: