0

I have this script:

Set WshShell = CreateObject("WScript.Shell")
dim a
a = "C:\Program Files (x86)\MyProgram\MyApplication.jar"
WshShell.Run "javaw -jar " & a

but when I execute, I got error message: "Error: Unable to access jarfile: C:\Program"

the problem is... my program path contain space(s). How to fix this?

bayuforest
  • 118
  • 2
  • 2
  • 10

2 Answers2

3

Can you try this? This worked for me.

Set WshShell = CreateObject("WScript.Shell")
dim a
a = "C:\Program Files (x86)\MyProgram\MyApplication.jar"
WshShell.Run "java -jar " &  chr(34) & a & chr(34) 
Pasupathi Rajamanickam
  • 1,982
  • 1
  • 24
  • 48
1

put your path in double "" see if it works. So your script should look like ""path with spaces""

ares777
  • 3,590
  • 1
  • 22
  • 23