This is the batch file I have created which copy the specific folders which I want. I use the specific server folder name of which I want to copy. This batch file will also delete the folder which you don't want to copy. My batch file will ask for the user input for the source path as well the destination path and to name the folder. If the user does not provides the source and destination path and folder name it will take the default value. I have also added a command which will start the specific service which is stopped. The concept of starting the service is totally related to server where we use to down the server. I also wanted my code to ask whether to delete those logs.
Please help me regarding this script and please suggest any improvements.
@echo off :: variables echo This script takes the backup of file SwiftALM Important folders set /P SOURCEPATHPATH=Enter SOURCEPATH example:D:\backup\test\swift (default SOURCEPATH path=D:\backup\test\swift): if "%SOURCEPATH%"=="" ( set SOURCEPATH=D:\backup\test\swift ) else ( set SOURCEPATH=%SOURCEPATH% ) set /P DESTPATH=Enter DESTPATH (default DESTPATH path=D:\backup4): if "%DESTPATH%"=="" ( set DESTPATH=D:\backup4 ) else ( set DESTPATH=%DESTPATH% ) set /P folder=Enter folder name: echo default folder name=%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4% if "%folder%"=="" ( set folder=%Date:~-7,2%-%Date:~-10,2%-%Date:~-4,4% ) else ( set folder=%folder% ) echo folder=%folder% mkdir %DESTPATH%\%folder% set xcopy=xcopy /E/V/Q/F/H/I echo echo conf folder will be copied %xcopy% %SOURCEPATH%\conf %DESTPATH%\%folder%\conf echo conf folder is copied echo lib folder will be copied %xcopy% %SOURCEPATH%\lib %DESTPATH%\%folder%\lib echo lib folder is copied echo deploy folder will be copied %xcopy% %SOURCEPATH%\deploy %DESTPATH%\%folder%\deploy echo deploy folder is copied echo deployers folder will be copied %xcopy% %SOURCEPATH%\deployers %DESTPATH%\%folder%\deployers echo deplyers folder is copied echo files will be copy press enter to proceed pause echo Deleting folders after copy rmdir /s %SOURCEPATH%\tmp rmdir /s %SOURCEPATH%\data rmdir /s %SOURCEPATH%\work echo folders have been removed pause echo To Start the task scheduler sc start "Schedule" pause