我在此程序中运行 CMD 命令时遇到问题。我正在使用“lua LuaSrcDiet.lua myscript.lua -o myscriptdone.lua”命令。每当我运行程序时,它都会告诉我找不到指定的文件。我猜这是因为命令提示符在运行时不在正确的目录中。正确的目录是用户文件夹。你有什么办法可以让我解决这个问题。非常感谢。
try
{
File.Copy(filedir1, userPath + "/myscript.lua", true);
}
catch
{
MessageBox.Show("There has been an problem. It may be because you need to select a Lua file to open.", "Love Compiler", MessageBoxButton.OK, MessageBoxImage.Error);
}
File.Copy("Stuff/LuaDiet/lua.exe", userPath + "/lua.exe", true);
File.Copy("Stuff/LuaDiet/LuaSrcDiet.lua", userPath + "/LuaSrcDiet.lua", true);
Process luarun = new Process();
luarun.StartInfo.WorkingDirectory = @"C:\Users\Leachman";
luarun.StartInfo.FileName = "lua LuaSrcDiet.lua myscript.lua -o myscriptdone.lua";
luarun.StartInfo.UseShellExecute = false;
luarun.StartInfo.Arguments = "/all";
luarun.StartInfo.RedirectStandardOutput = true;
luarun.StartInfo.CreateNoWindow = false;
luarun.Start();