Skip to content

Instantly share code, notes, and snippets.

@sphingu
Last active December 18, 2015 12:10
Show Gist options
  • Save sphingu/5781284 to your computer and use it in GitHub Desktop.
Save sphingu/5781284 to your computer and use it in GitHub Desktop.
Open Folder / Start .exe With arguments
//Process For Get Backup of Your Database
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "OSQL.exe";
myProcess.StartInfo.WorkingDirectory = @"C:\";
myProcess.StartInfo.Arguments = "-Usa -PmyPasword -n -Q \"BACKUP DATABASE msdb TO DISK = > 'c:\\msdb.dat_bak'\"";
myProcess.Start()
//Open Folder
public void OpenFolder(string dir)
{
string argument = @"/select, " + dir;
System.Diagnostics.Process.Start("explorer.exe", argument);
}
//Another Open Folder
string windir = Environment.GetEnvironmentVariable("WINDIR");
System.Diagnostics.Process prc = new System.Diagnostics.Process();
prc.StartInfo.FileName = windir + @"\explorer.exe";
prc.StartInfo.Arguments = dir;
prc.Start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment