Please help here im stuck with this issue where i am trying the fire the cmd.exe to perform a task but the cmd.exe file needs to be started with with admin rights and i wnt the file to be hidden and even if i set the process properties ProcessWindowStyle.Hidden.
How can i run the process with admin right and also hide the window because the minute i set UseShellExecute = True and comment out the user name and password than it hides the window. From what i can gather is that once you set UseShellExecute = false the
code does not hide the window.
See my code example below and it would really help if some could show me how to start the processs with admin right and keep the window hidden.
Dim myProcess As New Process ' Declare new instance of the process class
myProcess.StartInfo.FileName = "cmd.exe" '
myProcess.StartInfo.Arguments = "My Arguments here"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.Verb = "runas"
myProcess.StartInfo.UserName = Username
myProcess.StartInfo.Password = password
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.Start() ' Start the process
myProcess.WaitForExit() ' Wait for it to exit.
View Complete Post