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?

Brian
  • 12,145
  • 20
  • 90
  • 153

1 Answers1

1

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

&$a\winrar.exe
TechSpud
  • 3,418
  • 1
  • 27
  • 35