我正嘗試建立在C#中的小控制檯應用程序。我想運行該程序並將TFS中的所有待處理更改保存爲.txt文件。但我無法得到參數工作。有人能幫我嗎?運行「tf.exe狀態」在C#中,並保存結果
這裏是我的代碼,到目前爲止,我haved完成:
string argument = "@tf.exe status /collection:http://tiffany:8080/tfs/ /user:* /format:detailed >c:\\Status\\Detailed.txt";
try
{
Process process = new Process();
process.StartInfo.Arguments = "@call" + " " + "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\VsDevCmd.bat";
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.StartInfo.Arguments = argument;
process.StartInfo.CreateNoWindow = false;
process.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Console.ReadKey();
}
也許會更好地工作,但我不知道如何創建使用命令行.bat文件。你能給我一些提示嗎? – robertdahlberg
我認爲他的意思是不要使用C#程序,只需要一個批處理文件,其中包含調用'tf status ...'的頂級示例,即一行代碼包含您需要的所有內容。 –