Jump to content

Start-Process passing trailing spaces


rcmaehl
 Share

Recommended Posts

Hi all,

I'm experiencing an issue with Powershell passing trailing spaces within arguments and I'm quite restricted on what I can do due to contractual agreements. Is there a way to resolve this?

Input:

Powershell Start-Process 'C:\Program Files\Folder\program.exe' -Verb runAs -ArgumentList @('"parameter with spaces"', '-minimize')

Expected Passed Parameters:

  • "parameter with spaces"
  • "-minimize"

Actual Passed Parameters:

  • "parameter with spaces "
  • "-minimize "

Limitations

  • Program.exe must be ran from a program already running as admin (in this case powershell)
  • Not allowed to change default Execution Policy away from Restricted. So no Powershell scripts
  • Not allowed to install/execute external programs (so no AutoIt Scripts)
  • Works if made into a shortcut (.lnk) on the Desktop

Any advice would be appreciated. Thanks in advance

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Hello. Something like this should work from powershell.

 

Start-Process 'C:\Program Files\Folder\program.exe' -Verb runAs -ArgumentList @("`"parameter with spaces`"","`"-minimize `"")

 

Saludos

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...