1.

Solve : Help to decipher what this batch is doing??

Answer»

Can anyone help me translate the logic of this in English? I'm confused on what this is saying.

Thanks

************************************

@echo off

setlocal

echo REM Begin to copy 'App' dir to backup location > %outFile_CopyAppDir%

pushd "%ess_app_dir_source%"

for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCDIR "%%a"

popd@echo off
:: ensure local changes to ENVIRONMENT stay local
setlocal

echo REM Begin to copy 'App' dir to backup location > %outFile_CopyAppDir%

:: save the current working DIRECTORY
pushd "%ess_app_dir_source%"

:: STARTING from the middle, the dir statement lists directories in the current working folder
:: the >nul means send screen output to the nul 'bucket'
:: 2> means send any error output to the bucket; but > is reserved, so the ^> means
:: dont do the redirect within the FOR, but with the dir command when it is executing
:: the /f "tokens etc means - use the output of the command in the brackets
:: the call statement means call a subroutine within this batch, using the replaceable
:: parameter %%a (now HOLDING each directory name) as a paramenter to the
:: subroutine (Procdir)
for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCDIR "%%a"

:: restore the original saved working directory
popd

If you ARENT sure what these do, enter the following lines in a command window

setlocal /?
echo /?
pushd /?
popd /?
for /?
dir /?
call /?

and it will display help on each topic

Good luck
Graham



Discussion

No Comment Found