0

I'm having an issue with passing arguments to an executable through powershell.

The command that I pass is: .\migrator.exe migrate -d12345,12333,12222 -i09877,787896,76866

Here's where I am having an issue. The command works perfectly in CMD shell, but in powershell, it fails on the commas and will not execute the command. Do I need to be passing this into an array object or wrapping it with quotes or what?

5
  • "Do I need to be passing this into an array object or wrapping it with quotes or what?" Well, did you try any of those? It sounds like you have an idea of a few possible solutions, what's stopping you from trying & checking the results? Commented May 9, 2014 at 15:53
  • I barely know squat about powershell and with the environment I've been given to do this in, which is the production environment, I can just willy nilly test things. I'm kind of handcuffed. Commented May 9, 2014 at 15:54
  • Demand a test environment. There's no excuse to not have one, especially if you have people who are going to be doing things for the first time. Otherwise, you're being set up for failure. Commented May 9, 2014 at 15:55
  • The real problem is, no one here knows how this migrator.exe works, how it handles its arguments, how it processes things. So something that we think should work could blow up in your face. Commented May 9, 2014 at 15:56
  • Yeah that's the issue that I have. They hardcoded the paths, dbs etc into the exe instead of a config file, so anytime it gets executed, it's going to hit the production db. Commented May 9, 2014 at 15:59

1 Answer 1

1

If you are on PowerShell v3 or higher, you can have PowerShell pass the parameters to migrate.exe much like CMD would by using the --% operator e.g.:

.\migrator.exe migrate --% -d12345,12333,12222 -i09877,787896,76866
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.