Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)

I want to run tabcmd.exe utility to publish views in tableau server. Manual step to do this is as follows, log file will be updated for every step in the location


In the same session, I have to perform these steps manually one by one order

  1. Run cmd.exe
  2. log in by using the command tabcmd login -s "http:/sales-server:8000" -t Sales -u administrator -p p@ssw0rd!
  3. Create Project Name using the command tabcmd createproject -n "Quarterly_Reports" -d "Workbooks showing quarterly sales reports."
  4. Publish views by using the command tabcmd publish "analysis.twbx" -n "Sales_Analysis" --db-user "jsmith" --db-password "p@ssw0rd"
  5. Refresh by using the command tabcmd refreshextracts --workbook "My Workbook"
  6. Log out by using the command tabcmd logout

Now I am trying to automate these steps from my .Net win form, so I used the below code as a try and It is not working. 

String path = @"C:\Program Files (x86)\Tableau\Tableau Server\7.0\bin\tabcmd.exe"

ProcessStartInfo startInfo = new ProcessStartInfo ();

startInfo.FileName = "\""+path+ "\"";

startInfo.Arguments = String.Format("login -s http://Server1:8000 --db-user "jsmith" --db-password "p@ssw0rd");

startInfo.UseShellExecute = false ;

startInfo.CreateNoWindow = false;

startInfo.WindowStyle = ProcessWindowStyle.Normal;

startInfo.RedirectStandardOutput = true;

startInfo.RedirectStandardInput = true;

startInfo.RedirectStandardError = true;

Process p = new Process();

p.StartInfo = startInfo;


using (StreamWriter sw = p.StandardInput)


            if (sw.BaseStream.CanWrite)


                sw.WriteLine("createproject -n \"MyProject\" -d \"MyProjectWorkbook\"");

                //sw.WriteLine("My next Command");

                //sw.WriteLine("My next Command");



I am able to log in successfully and I am not able to proceed consequent steps further, I have no clue how to proceed on this further, so I am looking forward to some help on this. Thanks in advance! 


1 Answer

0 votes
by (47.2k points)
selected by
Best answer
  • You could try creating a batch file with all of those commands and execute the batch file from the command prompt like this:-

//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) 





    //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";




  • 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

Related questions

Browse Categories