I am not able to pass some parameters to my Dev cmd prompt for vs, I can do it with the classic cmd but not with this one. And I need it because I want to execute CodedUITests from an executable.
This is what my code looks like:
String Path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools\Developer Command Prompt for VS2012.lnk";
ProcessStartInfo proc = new ProcessStartInfo();
proc.FileName = Path;
proc.UseShellExecute = true;
proc.Arguments = @"/c MSTest/h";
Process.Start(proc);
It starts, but no args are inserted,what am I doing wrong ?
EDIT 1 - None of these are working
Process.Start(Path, @"/c "+"MSTest/h"); - err : invalid path - in dev cmd prompt
OR
Process.Start(Path, @"/c ""MSTest/h"); - err: invalid path - in dev cmd prompt
OR
Process.Start(Path, @"/c MSTest/h"); - nothing
OR
Process.Start(Path, "/c MSTest/h"); -nothing
OR
Process.Start(Path, "MSTest/h"); -nothing
EDIT 2 - This is how my final code looks like, partially working, dev cmd starting, but no way to parse args into it because any args I pass they go straight to cmd not to dev-cmd
// ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""");
ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", @"%comspec% /k ""C:\Users\butoiu.edward\Desktop\VsDevCmd1.bat");
procStartInfo.UseShellExecute = false;
// procStartInfo.Arguments = "/k MSTest";
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.Start();
proc.WaitForExit();
lnk" file it is actually a link of visual studio cmd prompt. Instead of this location you try original file located at "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
I hope this will help you.
Did you try this way?
--
FMI
MSDN LINKUpdate:
I assume it will work this way... but not sure
Open sys default cmd prompt.. and give first param as batch file path (
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat
) and give a space and add next attribute.