0

I have path of an application in a string what I want to run. For example: [io.path]::Combine($path, $filename) it be interpreted as C:\foo\baa.exe. I have tried using &$path operator but it don't works by using variable.

2 Answers 2

3

I just had both & $path (note the space) and Invoke-Item $path work.

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

1 Comment

Thanks. It's possible to pass arguments to program?
3

Something like:

$path = "C:\Windows\System32\notepad.exe"
&$path

should work. Make sure you are setting path correctly. There is no need for a space after the &.

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.