Vb.net Shell命令给出错误“0”;“和”之后的错误;
我用过:Vb.net Shell命令给出错误“0”;“和”之后的错误;,vb.net,visual-studio-2008,shell,cmd,command-prompt,Vb.net,Visual Studio 2008,Shell,Cmd,Command Prompt,我用过: Shell(“cmd/k type”&System.IO.Path.GetTempPath&“file.exe>”&Application.ExecutablePath&“:file.exe”) 临时文件夹:C:\Documents and Settings\Admin\Local Settings\Temp\ 命令提示窗口给出错误:未找到文件,错误在:和之后。系统找不到目标路径 我认为问题在于这个名称:文档和设置 我该怎么做才能让它活过来 p.S:文件存在,当我使用:start命令时
Shell(“cmd/k type”&System.IO.Path.GetTempPath&“file.exe>”&Application.ExecutablePath&“:file.exe”)
临时文件夹:C:\Documents and Settings\Admin\Local Settings\Temp\
命令提示窗口给出错误:未找到文件,错误在:和
之后。系统找不到目标路径
我认为问题在于这个名称:文档和设置
我该怎么做才能让它活过来
p.S:文件存在,当我使用:
start
命令时,它可以工作。您可能需要将路径放在“”之间。差不多
Shell("cmd /k type \"" & System.IO.Path.GetTempPath & "file.exe\" > " & Application.ExecutablePath & ":file.exe")
你需要额外的包装报价
Shell("cmd /k type """ & System.IO.Path.GetTempPath & "file.exe"" > " & Application.ExecutablePath & ":file.exe")
空格是命令行参数中的分隔符。如果单个参数中有空格,则需要将整个参数用引号括起来。谢谢,但在Vb中是“”而不是\“