How can I open PowerShell via AutoHotkey?
I'm running AutoHotkey 1.0.48.05 on Windows 7.
I'd like CTRL-ALT-P to open PowerShell.
This is what I have so far:
^!p::
Run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Return
This is the error I get:
File C:\Users[username]\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
I've already set the execution policy to RemoteSigned by opening PowerShell ISE as Administrator and running Set-ExecutionPolicy RemoteSigned
. (See http://technet.microsoft.com/en-us/library/ee176949.aspx)
How can I get around this problem?
UPDATE: In Windows 10, I don't even need AutoHotKey for this. Instead, I can press WIN+X, A, then Yes.
If you are in a 64 bit version of windows, you would need to set the execution policy for both 64 bit powershell and 32 bit.
This means you need to run the same command in both a 32-bit powershell session and 64-bit powershell session. For 32-bit powershell, just search for "Windows Powershell (x86)" in the Start menu.
I recently ran into the same issue. Instead of changing my execution policy for all scripts, I went with this:
#p::
^!p::
EnvGet, SystemRoot, SystemRoot
Run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy unrestricted,
return