C# 通过 total-commander 在 C:Windowssystem32 中打开文件夹
本文关键字:文件夹 Windowssystem32 通过 total-commander | 更新日期: 2023-09-27 18:36:46
我在使用总指挥官打开 Windows 系统文件夹时遇到了一点问题当我在cmd中手动运行命令时,还可以,但是当它以ProcessStartInfo运行时则不行。此问题发生在Windows XP上,Windows 7参数(路径)有点不同,但可以工作。
ProcessStartInfo startInfo = new ProcessStartInfo(); //New Proccess
startInfo.Arguments = "/L=" + GetArgument(); //Return C:'WINDOWS'system32'config'systemprofile'Local Settings'Application ata'MyApp'update'download [it´s OK]
startInfo.WorkingDirectory = Path.GetDirectoryName(GetTcmdPath());
startInfo.FileName = GetTcmdPath(); //returns C:'Program Files'totalcmd'TOTALCMD.EXE [it´s OK]
Process.Start(startInfo); //Start proccess
TC 已启动,但路径为:C:''WINDOWS''system32''config''systemprofile,不知道为什么有人可以帮我吗?
编辑:当我在没有"
的情况下在cmd C:'Program Files'totalcmd>TOTALCMD.EXE /L=C:'WINDOWS'system32'config'systemprofile'Local Settings'Application Data'MyApp'update'download
中运行时
相反
C:'Program Files'totalcmd>TOTALCMD.EXE /L="C:'WINDOWS'system32'config'systemprofile'Local Settings'Application Data'MyApp'update'download"
它不起作用但不知道如何在程序中添加"
?
我找到了问题的答案,所以如果您需要在字符串变量中添加双引号,请使用如下所示的内容:
startInfo.Arguments = string.Format("/L='"{0}'"", GetArgument());