c# open folder in C:\Windows\system32 via total-commander

853 Views Asked by At

I have a little problem with opening windows system folder using total-commander When i run command manually in cmd it´s ok, but when it runs as ProcessStartInfo not. This problem happens on Windows XP, Windows 7 argument (path) is a little bit different but working.

            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 is started but path is: C:\WINDOWS\system32\config\systemprofile and don´t know why Can anybody help me please?

Edit: When I run in cmd C:\Program Files\totalcmd>TOTALCMD.EXE /L=C:\WINDOWS\system32\config\systemprofile\Local Settings\Application Data\MyApp\update\download without "

instead

C:\Program Files\totalcmd>TOTALCMD.EXE /L="C:\WINDOWS\system32\config\systemprofile\Local Settings\Application Data\MyApp\update\download"

it´s not working but don´t know how to add " in program?

1

There are 1 best solutions below

0
On

I found the answer on my question so if you need add double quotes to string variable use something like this:

startInfo.Arguments = string.Format("/L=\"{0}\"", GetArgument());