Jump to content
rcmaehl

Start-Process passing trailing spaces

Recommended Posts

rcmaehl

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
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
Danyfirex

Hello. Something like this should work from powershell.

 

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

 

Saludos

  • Like 1

Share this post


Link to post
Share on other sites
rcmaehl

I'll give it a try! Thanks!


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
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
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

×