加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何在runonce-Key中运行powershell脚本?

发布时间:2020-12-13 22:38:56 所属栏目:Windows 来源:网络整理
导读:我有一个看起来像这样的power shell.exe,它可以从我的命令行运行: powershell.exe -noexit -command " 'C:Testtest.ps1' " 但是,当我在当前用户的runonce-key中完全按照那种方式输入该条目时,没有任何反应. 从runonce调用powershell.exe传递参数或运行的
我有一个看起来像这样的power shell.exe,它可以从我的命令行运行:

powershell.exe -noexit -command " & 'C:Testtest.ps1' "

但是,当我在当前用户的runonce-key中完全按照那种方式输入该条目时,没有任何反应.

从runonce调用powershell.exe传递参数或运行的正确方法是什么?

解决方法

尝试使用完整路径:

c:WINDOWSsystem32WindowsPowerShellv1.0powershell.exe -noexit "C:Testtest.ps1"

要么

c:WINDOWSsystem32WindowsPowerShellv1.0powershell.exe -noexit -command " & 'C:Testtest.ps1' "

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读