Sunday, 5 January 2014

Windows Batch script for setting up environment

@echo off
echo > %TEMP%\tpplist.txt
echo > %TEMP%\tppfinal.txt
cls
set dash=#################################################################### 
echo %dash%
echo.
echo Select the 3pp from the below list
echo %dash%
echo.

type  C:\Users\spraveen\Documents\file_list_new.txt
echo.
echo %dash%
echo.

echo Enter the 3pp name
echo.
set /p as=
echo.
echo %dash%
echo.
echo Please select the version that you want to set from the below list  Please type the full name as like in the list or copy paste
echo.
echo %dash%
echo.
type C:\Users\spraveen\Documents\log.txt | findstr /i %as%

if %errorlevel% neq 0 (
echo The 3pp that you have entered is not in the list \n
goto ERROR
)

type C:\Users\spraveen\Documents\applications.txt | findstr /i %as% >> %TEMP%\tpplist.txt

echo.
echo %dash%
echo.
echo Please enter the version name
echo.
echo %dash%
echo.
set /p threever=
echo.
type %TEMP%\tpplist.txt | findstr /i %threever%

if %errorlevel% neq 0 (
echo The version you have entered is not in the list please re-enter properly
goto ERROR
)
echo.
echo %dash%
echo.
echo You have chosen the following version
echo.
echo %dash%
type %TEMP%\tpplist.txt | findstr /i %threever% >> %TEMP%\tppfinal.txt

for /f "tokens=1* delims==" %%u in (%TEMP%\tppfinal.txt) do (
echo %%u
)
echo.
echo %dash%
echo.

echo Confirm to set the version [y/n]
set /p inp=
set trig=false
if "%inp%" == "y" set trig=true
if "%inp%" == "Y" set trig=true
if "%trig%" == "true" (
echo hi
) else (
goto ERROR
)

for /f "tokens=2* delims==" %%v in (%TEMP%\tppfinal.txt) do (
echo %%v
)




:ERROR

No comments:

Post a Comment