'How to execute a Powershell (.ps1) file in Autohotkey?
Run, powershell.exe C:\Users\user1\PoweShell\Duplicate Selected Files.ps1
Running the above example just opens the blue powershell CMD window and it quickly flashes, the script does not run.
Running the below example opens the blue powershell CMD window and keeps it open, the script does not run.
Run, powershell.exe /k C:\Users\user1\AppLib\Executables\PoweShell\Duplicate Selected Files.ps1
I should mention in file explorer, double clicking a .ps1 file opens it in notepad, I should like to keep this behaviour. I can achieve the same in Autohotkey with:
Run, C:\Users\user1\AppLib\Executables\PoweShell\Duplicate Selected Files.ps1
I can execute .ps1 script files in file explorer by rich clicking and choosing Run with Powershell. How can I achieve this same result in Autohotkey?
PS: I know I can run Poweshell directly in Autohotkey with RunWait, powershell.exe -NoExit -Command "Something here..." I really need to how to execute .ps1 files saved to folders.
Any help would be greatly appreciated! I have taken the liberty to crosspost this question on other forums as well.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
