Home c# "Invalidly specified folder name" When starting a batch file for registration DLL

“Invalidly specified folder name” When starting a batch file for registration DLL




Task to start a batch file for registration of DLL, everything works on the computer under the admin.
But if you run on another computer under the user writes
“Invalidly specified folder name”

Created account specifically for these needs with admin rights

process pr = new process ();
        pr.startinfo.useshellexecute = false;
        pr.startinfo.filename = @ "C: \ users \" + username + @ "\ documents \ dll2.bat";
        pr.startinfo.verb = "runas";
        pr.startinfo.username = "admin";
        pr.startInfo.domain = "OS";
        PR.StartInfo.password = "Password";
        pr.start ();

tried to run and so “C: \ DLL2.BAT” – the error is the same.

Answer 1

Added a line and the problem disappeared

pr.startInfo.workingDirectory = Path.getDirectoryName (@ “C: \ Windows \ System32 \ cmd.exe”);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions