![](/img/trans.png)
[英]Powershell - Can it be determined if a script is run by right click “run with powershell”?
[英]how to use key board hotkey to run with powershell like right click mouse and choose run with powershell?
我在使用热键运行带有powershell的ps1文件时遇到问题,通常我们通过使用鼠标右键单击来运行ps1文件,然后选择“使用powershell运行”,但这对我来说太慢了,所以我喜欢使用热键来制作它,如果任何专家都知道答案,请帮忙。 谢谢
我发现执行此操作的最简单方法是创建一个简单的BAT文件:
打开记事本,然后输入以下内容
start powershell c:\scripts\powershell-script.ps1
更改c:\\scripts\\powershell-script.ps1
位置的c:\\scripts\\powershell-script.ps1
位。
然后选择文件>另存为>其他文件。 将其命名为“ start script.bat”或其他名称。 然后,您可以双击BAT文件,这将运行您的脚本。
也许有更好的方法,但这是我发现的最简单,最简单的方法,非常轻松。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.