title: Get full value of the variable and to execute tabcmd using batch file
body: <p>I am working on a batch script in which I need to get all the tableau workbooks inside a folder and append it with a set of tabcmd publish arguments and then execute the publish command using tabcmd. </p>
  
  <p>Below is my code;</p>
  
  <pre><code>    @ECHO OFF
  CLS
  ECHO **********************************************************************
  
  SET /p folderPath= "Please enter the folder path where the workbooks are saved: "
  ECHO '%folderPath%'
  SET /p tabsvr_path= "Please enter path of Tableau Server bin directory: "
  ECHO '%tabsvr_path%'
  SET /p project_name= "Please enter the project name where the workbooks needs to be saved: "
  ECHO '%project_name%'
  ECHO **********************************************************************
  ECHO *** Get all the txt files from the provided folder                 ***
  ECHO **********************************************************************
  cd %folderPath%
  setlocal enableDelayedExpansion
  set /a ID=1
  for /f "tokens=1* delims=:" %%G in ('dir *.twb /b') do (
      set filename[!ID!]=%%~G
      set filefullPath[!ID!]=%%~fG
      set /a ID+=1    
  )
  set filefullPath
  set filename
  ECHO **********************************************************************
  ECHO *** Get all the txt files from the provided folder                 ***
  ECHO **********************************************************************
  SET TAB_SERVER=http://domain.tableau.com
  SET DB_USERNAME=ApplicationUser
  SET DB_PASSWORD=@pp!User_!2#
  SET TAB_USERNAME=AnalyticsUser
  SET TAB_PASSWORD=Password
  
  SET "RUN_CMD=tabcmd "
  SET "PUB_SYN=publish ""
  SET "FIRST_PARAM=" -n ""
  SET "DBUSERNM=" --db-username ""
  SET "DBPASS=" --db-password ""
  SET WRKBKPROJ= %project_name%
  SET "OTHER_PARAMS=" --save-db-password --project ""
  SET "PARAM_CLOSE=" --tabbed""
  
  set "x=1"
  
  :SymLoop
  if not defined filefullPath[%x%] goto :endLoop
  set "EXEC_PATH=%tabsvr_path:"=%"
  set "EXEC_PATH=%EXEC_PATH:&lt;=^&lt;%"
  set "EXEC_PATH=%EXEC_PATH:&gt;=^&gt;%"
  if "%EXEC_PATH:~0,2%"=="C:" (
      if "%EXEC_PATH: =%"=="%EXEC_PATH%" (
        set tabsvr_path=%EXEC_PATH%
      ) else (
        set tabsvr_path=^"%EXEC_PATH%^"
      )
  )
  REM ECHO %tabsvr_path%
  CD /D %tabsvr_path%
  ECHO **********************************************************************
  ECHO *** Login into Specified Target Tableau Server                     ***
  ECHO **********************************************************************
  tabcmd login --no-certcheck -s %TAB_SERVER% -u %TAB_USERNAME% -p %TAB_PASSWORD%
  ECHO **********************************************************************
  
  CALL SET NEWWRKNAME=%FIRST_PARAM%%%filename[%x%]%%
  CALL SET ARGS1=%DBUSERNM%%DB_USERNAME%%DBPASS%%DB_PASSWORD%%OTHER_PARAMS%%TAB_PROJECT%%PARAM_CLOSE%
  REM ECHO %ARGS1%
  call set ARGS0=%RUN_CMD%%PUB_SYN%%%filefullPath[%x%]%%
  REM ECHO %ARGS0%
  ECHO %ARGS0%%NEWWRKNAME%%ARGS1%
  REM START /b /w /D  %ARGS0%%NEWWRKNAME%%ARGS1%
  SET /a "x+=1"
  GOTO :SymLoop
  :endLoop
  echo "Done"
  ECHO **********************************************************************
  ECHO *** Logout of the Specified Target Tableau Server                     ***
  ECHO **********************************************************************
  tabcmd logout
  ECHO **********************************************************************
  pause
  endlocal
  cd/
  cd /D %tabsvr_path%
  </code></pre>
  
  <p>Below are the problems I am facing. </p>
  
  <ul>
  <li>The password is not getting passed fully in the variable. Since I have "!" mark in the password, only the text till "!" is being passed into the variable.</li>
  </ul>
  
  <blockquote>
    <p>tabcmd publish "c:\Tableau Automation\AC.twb" -n "AC.twb"
    --db-username "ApplicationUser" --db-password "@pp" --save-db-password --project "" --tabbed"</p>
  </blockquote>
  
  <ul>
  <li>I am unable to invoke the tabcmd command. I am navigating into the bin folder where I have the tabcmd exe located and invoking that using the START. However, I am getting an error that publish is not valid. Below is the screenshot of the error;</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/7qpGr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7qpGr.png" alt="Error"></a></p>
  
  <p>Can anyone let me know how the script needs to be modified to get the entire password as well as invoking tabcmd? </p>