我已經能夠用下面的代碼之前啓動該程序:試圖在VBScript
dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
strCmd = "cmd.exe /c start /D C:\Jts C:\Windows\system32\javaw.exe -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame C:\Jts"
WshShell.Run(strCmd)
但是現在,多虧了精彩的java
更新,我java.exe
文件位於:
C:\Program Files (x86)\Java\jre1.8.0_31\bin\javaw.exe
我無法替換上述strCmd
變量,以便我的VBScript
不會出錯。我知道它與Program Files (x86)
間距有關,我試圖實現這個答案:How to use spaces in CMD?
但它似乎並沒有工作。請幫忙解釋一下這些空間的用途。
編輯:
我只是想通了。上帝,我討厭空間。顯然,這個工作,我想知道這是不是最好的解決辦法還是沒有:
strCmd = "cmd.exe /c start /D C:\Jts C:\""Program Files (x86)""\Java\jre1.8.0_31\bin\javaw.exe -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame C:\Jts"
雙引號的整個路徑,不僅是它的一部分。比照http://stackoverflow.com/a/17284837/603855或http://stackoverflow.com/a/14360807/603855 – 2015-03-03 10:47:47