I created a process in C# (say cmd.exe). But, the created exe is not able to access all of the files as a process run by the user.
The screenshot which I have embedded clearly illustrates this issue. The process (cmd) which my application created is in the left side and the one in right side is opened with a run command directly. I have made a dir cmd to execute on both of these command prompts. The difference in the count is greatly astonishing me.
Sorry it shouts that I don't have enough reputation. So just the link of the screenshot.
The Screenshot showing the difference in counts
I considered about the elevation of the application, because I thought that the process was not allowed to access all the files of the system to a standard user. So I elevated the process.
In my program, I tried to create a cmd prompt and execute the java command from it to run a jar file.
Also don't ask about the PATH variables (blah, blah, blah). Because the java.exe rests in the system32/ folder which is already in the PATH variable.
The following is the source code of a function that creates the new process.
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe");
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.Arguments = "/C java.exe";
process.StartInfo = startInfo;
process.Start();
Shortly,
- x is a new process created with Process.start
- x can't find a file which an usual app finds.
- x got admin rights also
- x is quite mysterious??
EDIT:
- Say x is a cmd.exe, It opens C:/windows/SysWOW64 instead of the expected C:/Windows/System32 on running the command
cd C:/Windows/System32/
- How do I visit the actual System32 folder?