0

I am trying to run in powershell script an utility which takes '<' symbol as an argument:

utility.exe op1 < op2

But all I've got after performing this command is several black lines divided by newline symbols.

I tried to use iex 'utility.exe op1 < op2'

Running the same command in cmd.exe works fine.

0

1 Answer 1

1

The problem you're going to face is that you're trying to replace the < operator with the standard input redirect operator from the standard command line. That's not how PowerShell works.

You can try escaping it:

utility.exe op1 `< op2;

If you're on PowerShell 3.0, you can try the stop parsing operator:

utility.exe --% op1 < op2;

I doubt either of those will work since utility.exe is expecting something to redirect standard input.

Assuming op2 is a filepath to a text file, you can try something like:

Start-Process -FilePath 'utility.exe' -ArgumentList 'op1' -RedirectStandardInput 'op2';

If I knew what you were actually trying to accomplish instead of requesting a general solution, I could be more precise.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.