batch file - AskForFolderName and check if folder Exists in .bat -
i have piece of code made time ago. simple check prompt user put in different name if folder name exists. reason not work. if folder exists should goto askforfoldername
. cannot figure out.
@echo off @setlocal enableextensions enabledelayedexpansion mode 90,10 color ::stage 3 - check folder :askforfoldername set /p newfolder=what name of iteam being sold? if ["%newfolder%"]==[] goto askforfoldername if exist "%newfolder%" ( echo folder exists echo. goto askforfoldername ) mkdir "003 - images ready\%newfolder%" move "002 - process images\"*.* "003 - images ready\%newfolder%" ping 127.0.0.1 -n 20 > nul exit
try this:
@echo off & setlocal enableextensions enabledelayedexpansion mode 90,10 color ::stage 3 - check folder :askforfoldername set /p "newfolder=what name of iteam being sold? " if "%newfolder%"=="" goto :askforfoldername if exist "003 - images ready\%newfolder%\" ( echo folder exists echo. goto askforfoldername ) mkdir "003 - images ready\%newfolder%" move "002 - process images\*.*" "003 - images ready\%newfolder%" timeout /nobreak /t 20 > nul exit
Comments
Post a Comment