using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows.Forms; namespace WinAlfred.Plugin.System { public class CMD : ISystemPlugin { public List Query(Query query) { List results = new List(); if (query.RawQuery.StartsWith(">") && query.RawQuery.Length > 1) { string cmd = query.RawQuery.Substring(1); Result result = new Result { Title = cmd, SubTitle = "execute command through command shell" , IcoPath = "Images/cmd.png", Action = () => { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Normal, FileName = "cmd.exe", Arguments = "/C " + cmd }; process.StartInfo = startInfo; process.Start(); } }; results.Add(result); } return results; } public void Init(PluginInitContext context) { } public string Name { get { return "CMD"; } } public string Description { get { return "Execute shell commands."; } } } }