【笔记】执行Powershell脚本
前言
执行Powershell脚本
直接运行ps1文件
.\script.ps1
:脚本文件路径
1 | .\script.ps1 |
通过powershell命令运行脚本
- 在快捷方式中可以将目标设置为
通过powershell命令运行脚本
的命令来运行脚本,可以实现拖拽其他文件到脚本文件上来传递参数
-ExecutionPolicy bypass
:允许运行未签名的脚本
1 | powershell.exe -file .\script.ps1 |
执行Powershell脚本
.\script.ps1
:脚本文件路径
1 | .\script.ps1 |
通过powershell命令运行脚本
的命令来运行脚本,可以实现拖拽其他文件到脚本文件上来传递参数
-ExecutionPolicy bypass
:允许运行未签名的脚本
1 | powershell.exe -file .\script.ps1 |