redrooster
New member
- Joined
- Oct 16, 2023
- Messages
- 1
- Programming Experience
- 10+
Hi,
I am trying to start a VMWare instance from inside my c# application. I am using the new System.Diagnostics.Process class.
The problem I have is how to start the VM instance if cmd.exe is the executbale I want to run, and I also want to run VMrun.exe from it, and pass in some startup arguments to vmrun.
Basically I want to run this
U:\Program Files (x86)\VMware\VMware Player\vmrun.exe start I:\VMWare\Virtual Machines\Ubuntu_Embedded_Pico\Ubuntu 64-bit (2).vmx
I've tried setting the working folder to the vmrun.exe files location, and specifying vmrun.exe as the filename, and tried cmd.exe as the filename etc. But I just can not seem to get he backslashes, quotes, commands and paths all correct. Any help would be greatly appreciated.
Any clues on how to do this ?
Thanks.
I am trying to start a VMWare instance from inside my c# application. I am using the new System.Diagnostics.Process class.
The problem I have is how to start the VM instance if cmd.exe is the executbale I want to run, and I also want to run VMrun.exe from it, and pass in some startup arguments to vmrun.
Basically I want to run this
U:\Program Files (x86)\VMware\VMware Player\vmrun.exe start I:\VMWare\Virtual Machines\Ubuntu_Embedded_Pico\Ubuntu 64-bit (2).vmx
I've tried setting the working folder to the vmrun.exe files location, and specifying vmrun.exe as the filename, and tried cmd.exe as the filename etc. But I just can not seem to get he backslashes, quotes, commands and paths all correct. Any help would be greatly appreciated.
Starting a VM Instance from C# Code:
var process = new System.Diagnostics.Process();
string args = " /K \"U:\\Program Files (x86)\\VMware\\VMware Player\\vmrun.exe\" start \"I:\\VMWare\\Virtual Machines\\Ubuntu_Embedded_Pico\\Ubuntu 64-bit (2).vmx\"";
var startInfo = new System.Diagnostics.ProcessStartInfo
{
WorkingDirectory = @"C:\Windows\System32",
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
FileName = @"C:\Windows\System32\cmd.exe",
Arguments = args,
UseShellExecute = true
};
process.StartInfo = startInfo;
process.Start();
break;
Any clues on how to do this ?
Thanks.