2011-11-28 62 views
0

我用:Shell命令提供錯誤「錯誤:和。」後。

Shell("cmd /k type " & System.IO.Path.GetTempPath & "file.exe > " & Application.ExecutablePath & ":file.exe")

臨時文件夾:C:\Documents and Settings\Admin\Local Settings\Temp\

命令提示符窗口中提供了錯誤:文件未找到,出錯後:and。系統找不到目標路徑。

我認爲這個問題是在這名:Documents and Settings

我應該怎麼做將其帶到生活嗎?

P.S:文件存在,它在我使用時工作:start命令。

回答

1

你需要額外的包裝報價。

Shell("cmd /k type """ & System.IO.Path.GetTempPath & "file.exe"" > " & Application.ExecutablePath & ":file.exe") 

空格是命令行參數中的分隔符。如果您在單個參數中有空格,則需要將整個參數用引號括起來。

+0

謝謝,它的工作原理。 – John

1

你可能需要把你的路徑放在「」之間。像

Shell("cmd /k type \"" & System.IO.Path.GetTempPath & "file.exe\" > " & Application.ExecutablePath & ":file.exe") 
+0

謝謝,但在Vb是「」,而不是\「 – John