我在 VB.NET 中开发了一个应用程序...
Dim DIAGTOOL_loc As String = Environment.CurrentDirectory & "\folder\file.exe"
Dim shellexec As New System.Text.StringBuilder
shellexec.AppendLine("@echo off")
shellexec.AppendLine("cls()")
shellexec.AppendLine(": begin()")
shellexec.AppendLine("cls()")
shellexec.AppendLine("START " & DIAGTOOL_loc.ToString)
shellexec.AppendLine("pause")
IO.File.WriteAllText("tester.bat", shellexec.ToString())
System.Diagnostics.Process.Start("tester.bat")
现在,当命令提示符打开时,它应该执行 file.exe (DIAGTOOL_loc),但是当 CMD 加载时,它说“Windows 找不到“C:\Users\ ...”
但为什么?怎么了?当我键入 Process.start(DIAGTOOL_loc) 时,在 DIAGTOOL_loc 变量中注册的路径有效,因此,该文件存在......为什么 cmd 找不到它?
这个命令:
shellexec.AppendLine("START " & DIAGTOOL_loc.ToString)
应该打开file.exe ...但它不起作用...