简体   繁体   中英

how to use key board hotkey to run with powershell like right click mouse and choose run with powershell?

I have a problem to run a ps1 file with powershell with using hotkey , normally we run ps1 file by using right click mouse and choose run with powershell , but that is too slow for me , so I like to use hotkey to make it , if any expert know the answer please help . Thanks

easiest way I have found to do this is to create a simple BAT file:

Open notepad and enter the below

start powershell c:\scripts\powershell-script.ps1

Changing the c:\\scripts\\powershell-script.ps1 bit for the location of your script.

Then file > save-as > other files. Name it as "start script.bat" or something. You can then just double click the BAT file and this will run your script.

There may be better ways, but this is the simplest and easiest way I found that is very painless.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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