【问题标题】:Automatically close command line window after executing an .ps1 File via batch通过批处理执行 .ps1 文件后自动关闭命令行窗口
【发布时间】:2023-03-25 08:04:01
【问题描述】:

我想通过批处理执行 .ps1 文件后自动关闭命令行窗口。 (批处理有效,但执行后窗口没有关闭/消失)

这是批次:

cd C:\
powershell.exe -noexit "& C:\Users\user1\Desktop\Test.ps1"
exit

我需要更改或添加什么?

【问题讨论】:

  • 嗯...删除-noexit怎么样?

标签: batch-file cmd


【解决方案1】:

使用start 命令解决您的问题。

代码:

start "" powershell.exe -noexit "& C:\Users\user1\Desktop\Test.ps1"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    • 2020-04-12
    • 2016-02-08
    • 1970-01-01
    • 2023-03-16
    相关资源
    最近更新 更多