/// <summary> /// Applies the specified exec list. /// </summary> /// <param name="execList">The exec list.</param> public static void Apply(List <WindowsExecutable> execList) { foreach (WindowsExecutable item in execList) { WindowsExecutor.Execute(item); } }
public void RunningProcessesTest() { List <RunningWindowsExecutable> actual; actual = WindowsExecutableManager.RunningProcesses; foreach (RunningWindowsExecutable item in actual) { if ("firefox.exe".Equals(item.Name)) { item.Kill = true; Console.WriteLine(item.Name); WindowsExecutor.Execute(item); } } }
/// <summary> /// Maps the specified mapping. /// /// /// </summary> /// <param name="mapping">The mapping.</param> /// <returns></returns> public static bool Mount(DriveMap mapping) { //net use z: \\127.0.0.1\c$ 3dylan3dog3 /USER:insiel\908099 /PERSISTENT:NO String temp = ""; if (mapping.Drive.Length > 0) { temp += mapping.Drive + " "; } if (mapping.RealPath.Length > 0) { string sTemp = mapping.RealPath.Trim(); if (!sTemp.StartsWith(@"\\")) { sTemp = @"\\" + sTemp; } temp += "" + sTemp + " "; } if (mapping.Username.Length > 0) { string pwd = mapping.Password; if (pwd != null) { temp += pwd + " "; } temp += "/USER:"******" "; } temp += "/PERSISTENT:NO"; return(WindowsExecutor.Execute("net", " use " + temp)); }
/// <summary> /// Unmounts the specified map. /// </summary> /// <param name="map">The map.</param> /// <returns></returns> public static bool Unmount(DriveMap map) { // net use /DELETE z: return(WindowsExecutor.Execute("net", " use /DELETE " + map.Drive)); }