powershellcommand-linesysinternals

Autorunsc64 (sysinternals) command line issue in PowerShell


I am trying to execute autorunsc64.exe (Sysinternals) in PowerShell like so:

"C:\Program Files (x86)\Autoruns\autorunsc64.exe" -a * > "C:\Program Files (x86)\Autoruns\output.txt"

However, it does not like single or double quotes anywhere. I've tried many variations but cannot seem to find the solution. I keep getting the following errors:

Unexpected token '-accepteula' in expression or statement

Unexpected token '-a' in expression or statement

If the paths do not have spaces, it works without issue:

C:\Temp\Autoruns\autorunsc64.exe -accepteula -a * > C:\Temp\Autoruns\output.txt

How can I type this up to work with C:\Program Files (x86)\Autoruns\autorunsc64.exe -a * > C:\Program Files (x86)\Autoruns\output.txt so it can run from these locations using PowerShell?


Solution

  • Very common question.

    & "C:\Program Files (x86)\Autoruns\autorunsc64.exe"
    

    Or even

    C":\Program Files (x86)\Autoruns\autorunsc64.exe"
    

    I would just add it to the path.