General discussion
-
Topic
-
Batch Script – Create Directory, User Prompted
I have the following batch script which creates a new directory after asking user to enter the desired folder name:
@echo off
set /p “folder=Enter the folder name to be created: ”
mkdir “%folder%\A-”
mkdir “%folder%\Investigation”
mkdir “%folder%\Photos”However, I’d like multiple user prompts to force the user in the naming convention of the folder for consistency. Example, instead of only one question asking the folder name: “2024-08-22” and then the folder is created 2024-08-22. We would prefer multiple prompts such as:
“Please enter 4 digit year” user would only enter 2024
“Please enter 2 digit month” user would only enter 08
“Please enter 2 digit day” user would enter 22The folder would then be named appropriately 2024-08-22
Suggestions?