Is there a way to start PowerShell in a specific folder from Windows Explorer, e.g. to right-click in a folder and have an option like \"Open PowerShell in this Folder\"?
It opens PowerShell window, when pressing Ctrl-Alt-T
. (Tested with Win10)
If your "active window" is a Windows Explorer -window, then the PowerShell is opened in the current folder. Otherwise, just open PowerShell in some default folder.
Usage: 1) Install AutoHotkey, and copy paste this into myscript.ahk 2) Replace
with path of your choice. 3) Run the script.
; Ctrl-Alt-T opens PowerShell in the current folder, if using Windows Explorer. Otherwise, just open the Powershell.
^!T::
if WinActive("ahk_class CabinetWClass") and WinActive("ahk_exe explorer.exe")
{
KeyWait Control
KeyWait Alt
Send {Ctrl down}l{Ctrl up}
Send powershell{Enter}
}
else
{
psScript =
(
cd 'C:\'
ls
)
Run "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -NoExit -Command &{%psScript%}
}
return