Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.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
C# 文件存在时出现Win32异常?_C# - Fatal编程技术网

C# 文件存在时出现Win32异常?

C# 文件存在时出现Win32异常?,c#,C#,在C#中,我得到了一个随机的Win32Exception。我是一个经验丰富的C语言程序员,但这是随机的!“quickbms.exe”文件确实存在 当我这样做的时候: commandPrompt.StartInfo.FileName = "start"; commandPrompt.StartInfo.Arguments = "\"" + Application.ExecutablePath + "\\src\\quickbms.exe\" -o \"src\\overworld.bms\" \"

在C#中,我得到了一个随机的Win32Exception。我是一个经验丰富的C语言程序员,但这是随机的!“quickbms.exe”文件确实存在

当我这样做的时候:

commandPrompt.StartInfo.FileName = "start";
commandPrompt.StartInfo.Arguments = "\"" + Application.ExecutablePath + "\\src\\quickbms.exe\" -o \"src\\overworld.bms\" \"savegame_d.dat\" \"src\\xbla\\Savegame_Files\\regions\"";
commandPrompt.Start();
commandPrompt.WaitForExit();
(commandPrompt=System.Diagnostics.Process)

发生这种情况(使用自定义异常窗口):

很多人会说“文件不存在”,但它确实存在

问题在于你的“开始”参数

commandPrompt.StartInfo.FileName = "start";
        commandPrompt.StartInfo.FileName = "\"" + Application.ExecutablePath + "\\src\\quickbms.exe\";
        commandPrompt.StartInfo.Arguments =  "-o \"src\\overworld.bms\" \"savegame_d.dat\" \"src\\xbla\\Savegame_Files\\regions\"";
        commandPrompt.Start();
        commandPrompt.WaitForExit();
没有名为start的windows命令。Win+R+“开始”=错误 如果删除Arguments行,将得到完全相同的错误

您应该直接在Filename中调用该文件,而不是在参数中调用

commandPrompt.StartInfo.FileName = "start";
        commandPrompt.StartInfo.FileName = "\"" + Application.ExecutablePath + "\\src\\quickbms.exe\";
        commandPrompt.StartInfo.Arguments =  "-o \"src\\overworld.bms\" \"savegame_d.dat\" \"src\\xbla\\Savegame_Files\\regions\"";
        commandPrompt.Start();
        commandPrompt.WaitForExit();

可能是权限问题?好吧,Gyazo的工具提示真的很烦人。你启动一个名为start.exe的程序时带了一些参数,但是从start.exe文件中得到了一个异常。E:是映射驱动器吗?可能是网络问题。其中没有名为
start
或使用cmd.exe、args=“start etc”的文件。