Upload, Activate, Deactivate, Remove Form Templates by Batch File

Here are commnds for bact file

------------------------------------------------------------------------------------------------

@echo off

setlocal

SET SPDIR="%ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\12"
SET FRONTIER_URL=https://siteurl
SET XSN_PATH=xsnfilepath

echo Deactivating the template:
%SPDIR%\bin\stsadm.exe -o DeactivateFormTemplate -url %FRONTIER_URL% -filename %XSN_PATH%
if %ERRORLEVEL% neq 0 goto Errors

echo Removing the template: 
%SPDIR%\bin\stsadm.exe -o RemoveFormTemplate -filename %XSN_PATH%
if %ERRORLEVEL% neq 0 goto Errors

echo SharePoint Timer, force it to complete immediately
%SPDIR%\bin\stsadm.exe -o execadmsvcjobs
if %ERRORLEVEL% neq 0 goto Errors

echo Uploading the template: 
%SPDIR%\bin\stsadm.exe -o UploadFormTemplate -filename %XSN_PATH%
if %ERRORLEVEL% neq 0 goto Errors

echo SharePoint Timer, force it to complete immediately
%SPDIR%\bin\stsadm.exe -o execadmsvcjobs
if %ERRORLEVEL% neq 0 goto Errors

echo Activating the template: 
%SPDIR%\bin\stsadm.exe -o ActivateFormTemplate -url %FRONTIER_URL% -filename %XSN_PATH%
if %ERRORLEVEL% neq 0 goto Errors

goto Quit

:: -----------------------------------------------
::
:Errors

echo Warning! One or more errors detected.

:: -----------------------------------------------
::
:Quit

echo Done

:: -----------------------------------------------
::

------------------------------------------------------------------------------------------------

Comments