Problem running a powershell command

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
plykour
Posts: 1
Joined: 06 Jul 2018, 13:16

Problem running a powershell command

06 Jul 2018, 13:28

Hi.
I have an .ahk script containing the following single line (really this line is causing my problem)

RunWait, Powershell.exe -NoExit -Command $mycred = New-Object System.Management.Automation.PSCredential ("[email protected]", "testpasswd")

but the script fails with this error:

Missing closing ')' in expression.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndParenthesisInExpression


Please help.
User avatar
WeirDave
Posts: 13
Joined: 31 Oct 2023, 17:54

Re: Problem running a powershell command

07 Mar 2024, 18:45

Perhaps you should try to assign the variable before sending it to Powershell?

I was also going to suggest that you are not actually giving it a command:

-NoExit -Command $mycred = New-Object System.Management.Automation.PSCredential ("[email protected]", "testpasswd")

Not sure if that will help or not....

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Google [Bot], Joey5, mikeyww and 227 guests