0

I want to execute WinRAR.exe. The path of WinRAR is decided by a variable called $a. And I don't know how to correct the following code:

$a = "C:\Program Files\WinRAR"
$a\WinRAR.exe   # this line raises an error

I can see the value of echo $a:

$a = "C:\Program Files\WinRAR"
echo $a  # "C:\Program Files\WinRAR" is printed

And I'm sure that executing C:\"Program Files"\WinRAR\WinRAR.exe can launch WinRAR

Does anyone know why $a\WinRAR.exe is not working?

1
  • 1
    & "$a\WinRAR.exe" Commented Feb 18, 2017 at 11:23

1 Answer 1

1

Really simple. You need to prefix the call to winrar with an ampersand.

&$a\winrar.exe
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.