1.Powershell控制台 使用调用操作符(&)
>& "C:\test.ps1"

允许文件名中间带空格
>.\p.ps1 这种方式调用不允许带空格

powershell不同方式运行ps1文件

2.使用点号加载。在文件前加点号和空格,使用点号调用脚本会保持变量和函数在会话中
>. ".\p test.ps1"
>. "C:\p test.ps1"


3.用命令调用
PS C:\> powershell.exe -ExecutionPolicy RemoteSigned   -file "C:\p test.ps1"

相关文章:

  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2021-05-14
  • 2021-11-04
  • 2021-10-04
  • 2021-08-12
相关资源
相似解决方案