//Build Commands - You may have to play with the syntax
string[] cmdBuilder = new string[5]
{
@"tabcmd login -s 'http:/sales-server:8000' -t Sales -u administrator -p p@ssw0rd!",
@"tabcmd createproject -n 'Quarterly_Reports' -d 'Workbooks showing quarterly sales reports.'",
@"abcmd publish 'analysis.twbx' -n 'Sales_Analysis' --db-user 'jsmith' --db-password 'p@ssw0rd'",
@"tabcmd refreshextracts workbook 'My Workbook'",
@"tabcmd logout"
};
//Create a File Path
string BatFile = @"\YourLocation\tabcmd.bat";
//Create Stream to write to file.
StreamWriter sWriter = new StreamWriter(BatFile);
foreach (string cmd in cmdBuilder)
{
sWriter.WriteLine(cmd);
}
sWriter.Close();
//Run your Batch File & Remove it when finished.
Process p = new Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "C:\\cmd.exe";
p.StartInfo.Arguments = @"\YourLocation\tabcmd.bat";
p.Start();
p.WaitForExit();
File.Delete(@"\YourLocation\tabcmd.bat")
You need to build the batch file, then save it to a location, when you start the Process to run the batch file, the argument points to this file so that when cms.exe launches it runs the batch file