简体   繁体   English

Powershell无法识别脚本

[英]Powershell doesnt recognize script

Ive created a script for users in my company to use with powershell ise and when I run it there using F5 it is working. Ive为公司中的用户创建了一个脚本,以与powershell ise一起使用,当我在其中使用F5运行该脚本时,该脚本正在运行。

Ive set the executionpolicy to unrestricted as well. 我也将执行策略设置为不受限制。

Later Ive tried to open this script with powershell.exe because I need it to run straight for the users, and it gave the error: 后来我尝试使用powershell.exe打开此脚本,因为我需要它直接为用户运行,并且出现错误:

The term "C:\\users\\ofir\\Script\\Json is not recognized as a cmdlet, function, script file, or operable program.. 术语“ C:\\ users \\ ofir \\ Script \\ Json无法识别为cmdlet,函数,脚本文件或可运行程序。”

What could be the problem? 可能是什么问题呢? Thanks, Ofir. 谢谢,Ofir。

As I suspect you to run the file like powershell.exe -file C:\\Users\\What\\Not\\Json File.ps1 I could think of missing quotationmarks. 因为我怀疑您要运行powershell.exe -file C:\\Users\\What\\Not\\Json File.ps1类的powershell.exe -file C:\\Users\\What\\Not\\Json File.ps1我可能会想到缺少引号。

Try 尝试

  Powershell.exe -file "Path\To\File"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM