Home
Manage Your Code
Snippet: Use Process and process.start for commandline call to export registry to file type txt or rtf or reg (C#)
Title: Use Process and process.start for commandline call to export registry to file type txt or rtf or reg Language: C#
Description: Create Instance System.Diagnostics.Process using new for processname Variable, Define string for cmd line like you type in runbox, use System.Diagnostics.Process.Start arg1 open command win, arg2 is string where /c runs & term win & SAVEpath-filename ext Views: 250
Author: Johnny Rowe Date Added: 12/31/2008
Copy Code  
1System.Diagnostics.Process process1;
2process1 = new System.Diagnostics.Process();
3//Do not receive an event when the process exits.
4process1.EnableRaisingEvents = false;
5
6//regTest file ExtenderProvidedPropertyAttribute works in Region, txt, rtf
7//The "/C" Tells Windows to Run The Command then Terminate 
8string strCmdLine;
9strCmdLine = "/C regedit.exe /e C:\\Users\\JohnnyL\\Desktop\\RegTest1.rtf"; 
10
11System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
12process1.WaitForExit();
13process1.Close();
Usage
Win2000 & earlier Platformss may require command not cmd. You could hide cmd window.
WaitForExit should be used & close is required.
Notes
start method has many other calls available. Change your filename extention to whatever file type format reg, txt, rtf, doc sneekerdog@comcast.net