Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Shell命令给出错误“0”;“和”之后的错误;_Vb.net_Visual Studio 2008_Shell_Cmd_Command Prompt - Fatal编程技术网

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中是“”而不是\“