微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Windows – 通过PowerShell运行.cmd文件

我试图在PowerShell的远程服务器上运行一个.cmd文件.

在我的ps1脚本中,我已经尝试过:

C:\MyDirectory\MyCommand.cmd

导致此错误

C:\MyDirectory\MyCommand.cmd is not recognized as the name of a cmdlet,function,script file,or operable program.

和这个

Invoke-Command C:\MyDirectory\MyCommand.cmd

导致此错误

Invoke-Command : Parameter set cannot be resolved using the specified named 
parameters.

我不需要将任何参数传递给powershell脚本.我正在寻找什么正确的语法?

invoke-item查找文件类型的认处理程序,并告诉它运行它.在资源管理器中双击文件或使用start.exe基本相同.

原文地址:https://www.jb51.cc/windows/371612.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐