As an example, the following AHK script works perfectly:
Code: Select all
psScript =
(
# This is a comment
Get-HotFix | Select HotFixID,InstalledOn,InstalledBy -First 1
)
; Use this call if you don't want to see PowerShell output
;RunWait PowerShell.exe -Command &{%psScript%} ,, hide
; Use this call if you want to see PowerShell output
Run powershell.exe -NoExit -Command &{%psScript%}
Code: Select all
psScript =
(
Get-HotFix | Select HotFixID,InstalledOn,InstalledBy -First 1
# This is also a comment but creates an error because it's the final line of the PowerShell code block!
)
; Use this call if you don't want to see PowerShell output
;RunWait PowerShell.exe -Command &{%psScript%} ,, hide
; Use this call if you want to see PowerShell output
Run powershell.exe -NoExit -Command &{%psScript%}