Link to home
Start Free TrialLog in
Avatar of Jetixil
Jetixil

asked on

Executing a string as a command

Hi,

I have read a string from some key in the registry, this string contains a command which should run to uninstall something....   how do i execute the command which i have found in the registry(i have written this command into a string)?

Thank You.
Avatar of kirankumar_goura
kirankumar_goura
Flag of India image

You can use Process.Start method in the namespace System.Diagnostics to achieve this functionality.
For example if your string is something like
String str = "Application.exe /u";
then split it using String[] strings = str.Split(' ')
and the execute with the following statement
Process.Start(strings[0], strings[1]);

Let me know for further assistance.

ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial