【问题标题】:Executing file from Admin CMD via CLI通过 CLI 从 Admin CMD 执行文件
【发布时间】:2018-11-06 10:06:22
【问题描述】:

我正在尝试通过具有管理权限的 CMD 执行文件。

如何通过具有管理权限的命令行打开 cmd。

我必须在脚本中执行脚本。

 powershell -ExecutionPolicy ByPass -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -File C:\scripts\install_ims.ps1' -verb RunAs}"

我已经在一个 bat 文件中尝试过,但是在脚本中执行时它不起作用。

【问题讨论】:

标签: windows batch-file cmd


【解决方案1】:

这应该可以满足您的目的。

powershell -Command "Start-Process <filename> -Verb RunAs" 

这是从我最近几天最终添加到 GitHub 的一些批处理文件中复制粘贴的,如果您有任何问题,那可能是最好的去处。 https://github.com/Benny121221/Batch-BS

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2014-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多