Schedule name: OwnStartBat
Exec file: ownStart.bat
Any user logon
const String OWN_START_BAT_PATH = "C:\\ivme\\ProgramChecker\\ownStart.bat";
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/c schtasks /create /tn \"OwnStartBat\" /tr "+OWN_START_BAT_PATH+ " /sc onlogon";
startInfo.Verb = "runas";
process.StartInfo = startInfo;
process.Start();
Success("Running task schduale on user logon successfully");
Hiç yorum yok:
Yorum Gönder