.BAT script only running 1st command.
Posted: 16 Jun 2018 06:37
Hi
I got the batch script below that asks me 3 questions. It comes up with the 1st question OK but when I push Y or N thats it stopsand goes no further.
What am I doing wrong? Script below.
I got the batch script below that asks me 3 questions. It comes up with the 1st question OK but when I push Y or N thats it stopsand goes no further.
What am I doing wrong? Script below.
Code: Select all
@echo off
setlocal EnableDelayedExpansion
rem Define folder paths
set BaseDir=C:\DOWNLOADS
set DestDir1=C:\DAVID DOWNLOADS
set DestDir2=C:\JAMES DOWNLOADS
set DestDir3=C:\DISK BURNING FOLDER
rem Quit if no files in download area to process
set Empty=Y
for %%A in ("%BaseDir%\*.*") do set Empty=N
if "%Empty%" EQU "Y" (
echo No new files to process, quitting.
exit /b
)
rem Prompt for reference number
set RefNum=
set /P "RefNum=Enter reference number (blank to exit):"
rem If none entered, exit script
if "%RefNum%" EQU "" exit /b
rem Make a subfolder for the reference number
md "%BaseDir%\%RefNum%"
rem Move all files to new subfolder
move "%BaseDir%\*.*" "%BaseDir%\%RefNum%"
rem Ask if DAVID download to determine where to move the new folder
choice /C YN /M "IS THIS A DAVID DOWNLOAD (Y/N)?"
if !ERRORLEVEL! EQU 1 (
move "%BaseDir%\%RefNum%" "%DestDir1%"
echo msgbox "DO NOT FORGET TO GO INTO DAVID DOWNLOADS FOLDER”
> "%temp%\popup.vbs"
wscript.exe "%temp%\popup.vbs"
) else (
choice /C YN /M "IS THIS A JAMES DOWNLOAD(Y/N)?"
if !ERRORLEVEL! EQU 1 (
move "%BaseDir%\%RefNum%" "%DestDir2%"
echo msgbox "DO NOT FORGET TO GO INTO JAMES DOWNLOADS AND PASSWORD PROTECT FOLDER!!!!" > "%temp%\popup.vbs"
wscript.exe "%temp%\popup.vbs"
) else (
choice /C YN /M "IS THIS A BURN TO DISK DOWNLOAD? (Y/N)?"
if !ERRORLEVEL! EQU 1 (
move "%BaseDir%\%RefNum%" "%DestDir3%"
echo msgbox "NOW GO INTO DVD DRIVE AND BURN TO DISK. " > "%temp%\popup.vbs"
wscript.exe "%temp%\popup.vbs"
rem Remove ALL files from base download folder
del /s /q "%BaseDir%\*.*"
rem Remove any remaining subfolders too
for /d %%A in ("%BaseDir%\*.*") do rd /s /q "%%~A"