Dim proc As Process = Nothing Dim batDir As String = String.Format("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\") proc = New Process() proc.StartInfo.WorkingDirectory = batDir proc.StartInfo.FileName = "test.bat" proc.StartInfo.Verb = "runas" 'add this to prompt for elevation proc.StartInfo.UserName = "admin" proc.StartInfo.Domain = "sun.ad" proc.StartInfo.Password = theSecureStringPassword proc.StartInfo.UseShellExecute = False proc.StartInfo.CreateNoWindow = False proc.StartInfo.RedirectStandardOutput = True proc.StartInfo.RedirectStandardError = True proc.Start() proc.WaitForExit() MessageBox.Show("Bat file executed !!")
Quote:without UAC prompt.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)