does anyone knows, how could i give permissions to package that calls bat file, because under limited user it calls, but it dont works, and also if i launch like user with admin rights it popups black window and ask yes or no to change setting, so i should take that off some how too.
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


You can turn off UAC to get UAC out of the way but I would not recommend it. To elevate the batch file there is no magic fix, you are going to have to pick an elevation mechanism that meets your needs and putting passwords inside of scripts is definately not recommended either.
Answered 03/18/2010 by: kkaminsk
Ninth Degree Black Belt

Please log in to comment

Microsoft does have an official Windows 7 Support Forum located here http://social.technet.microsoft.com/Forums/en-US/category/w7itpro/ . It is supported by product specialists as well as engineers and support teams. You may want to also check the threads available there for additional assistance and guidance.

Microsoft Windows Client Team
Answered 03/31/2010 by: JessicaD
Senior Yellow Belt

Please log in to comment
Okay, running .BAT files from ASP.NET using the System.Diagnostics.Process object and static methods this should be easy, right? Well, this might work for you, but it certainly won't work on my machines. And after doing lots of reasearh on the issue, it seems that other people are also having problems with this too. I wrestled with permissions and all sorts of other stuff, trying to get a simple batch file to run, with no luck. I tried lauching the bat file directly, launching cmd.exe and calling the bat file using stin. No dice. It seems that something on my machine was keeping an unattended process from running bat files. This makes sense, but I was never able to pinpoint what was preventing this, so I came up with a workaround. I realized that since I could sucessfully run cmd.exe, and send commands to it via stin, I could just open the batch file, and send each line to cmd.exe, which is essentially the same as running a batch file itself. This technique works great, and I thought I'd pass along the code here. // Get the full file path
string strFilePath = “c:\\temp\\test.bat”; // Create the ProcessInfo object
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = “c:\\temp\\“; // Start the process
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi); // Open the batch file for reading
System.IO.StreamReader strm = System.IO.File.OpenText(strFilePath); // Attach the output for reading
System.IO.StreamReader sOut = proc.StandardOutput; // Attach the in for writing
System.IO.StreamWriter sIn = proc.StandardInput; // Write each line of the batch file to standard input
while(strm.Peek() != -1)
} strm.Close(); // Exit CMD.EXE
string stEchoFmt = "# {0} run successfully. Exiting"; sIn.WriteLine(String.Format(stEchoFmt, strFilePath));
sIn.WriteLine("EXIT"); // Close the process
proc.Close(); // Read the sOut to a string.
string results = sOut.ReadToEnd().Trim(); // Close the io Streams;
sOut.Close(); // Write out the results.
string fmtStdOut = "<font face=courier size=0>{0}</font>";
this.Response.Write(String.Format(fmtStdOut,results.Replace(System.Environment.NewLine, "<br>"))); That's it! Works like a charm!
Answered 05/01/2010 by: plus2plus
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity