I am trying to learn more about batch scripts and I have googled this question without really understand what I am reading.
So i have the following batch script to create multiple folders. The batch script creates the folders with the current date in the folder name. It also prompts the user for the folder name. The only thing I cant get right is how I can have spaces in the folder name. If I call the folder e.g My documents nothing will happen (the batch will not work).
So how can I enable this batch to accept spaces in the file name?
:: DATE SETTINGS
@ECHO off
SETLOCAL ENABLEEXTENSIONS
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
for /f "tokens=%toks% delims=.-/ " %%i in ('date/t') do (
set '%%a'=%%i
set '%%b'=%%j
set '%%c'=%%k))
if %'yy'% LSS 100 set 'yy'=20%'yy'%
set Today=%'yy'%-%'mm'%-%'dd'%
ENDLOCAL & SET v_year=%'yy'%& SET v_month=%'mm'%& SET v_day=%'dd'%
:: ECHO Today is Year: [%V_Year%] Month: [%V_Month%] Day: [%V_Day%]
::------------------------------------------------------------------------------------------------
::AskForFolderName
set /p NewFolder=Enter folder name here:
If [%NewFolder%]==[] Goto AskForFolderName
If Exist "%NewFolder%" (
Echo Folder already exists
Echo.
Goto AskForFolderName
)
::------------------------------------------------------------------------------------------------
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\IMAGES\RAW IMAGES"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\IMAGES\EXPORTS\JPG"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\IMAGES\EXPORTS\PNG"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\IMAGES\EXPORTS\PSD"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\VIDEO\RAW VIDEO"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\VIDEO\EDITS"
MD "%V_Year%.%V_Month%.%V_Day% - %NewFolder%\VIDEO\EXPORTS"