|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
DOS Batch - User input (multiple words) to create folder name
It's been a LONG time since I have needed to write batch files, but here I am!
Ok, here's what I need, I have a script that currently requires the user to type the entire name of the current test as a folder name and many times they get it wrong. Looking to automate this to eliminate some errors. The users are creating folders like this: PASS_OEM_TESTNAME_DATE_LOCATION What I would like is for the batch to ask questions then concatenate the results. Pass/Fail? PASS_ OEM/ENG? OEM_ TESTNAME? ABCD_ etc... Then create the folder PASS_OEM_ABCD_ ... I hope I explained this properly. THANKS! |
|
|||
|
Getting closer...
Code:
@echo off cls :menu ECHO ........................... ECHO Test result, Pass or Fail? ECHO ........................... ECHO P - Pass ECHO F - Fail ECHO. Set /p T= Test result? Pass or Fail? IF /i %T%==p goto pass IF /i %T%==f goto fail GOTO ERR :err ECHO Not a valid entry Pause ECHO Press any key to return to the menu CLS GOTO Menu :pass set result=PASS :fail set result=FAIL cd %userprofile%\desktop set folder=%result%_%date:~10,4%_%date:~4,2%_%date:~7, 2% mkdir %folder% pause The problem is when I us "P" for pass, I still get FAIL as the output. Any idea where I'm going wrong? Thanks! -Cd |
|
||||
|
Wrong case, perhaps?
Or maybe you have to do this: Code:
IF /i %T%=="p" goto pass
__________________
Ask Questions the Smart Way ![]() "In front of a monitor is a dangerous place from which to view the world." --Terri Wells Enable BSOD: Control Panel/Systems, Advanced Tab, hit the Settings button under Startup and Recovery, and under the System Failure area, uncheck the Automatically Restart checkbox. |
|
|||
|
Sorry, I didn't mean I actually type "P" as seen. I just type p or P, either one should trigger the event.
I'm thinking it's part of the set command that I'm making my mistake on. maybe it should be set /p results=PASS or??? |
|
|||
|
Geez I'm an idiot....
I forgot to tell the script where to go AFTER it has placed the "Pass" or "Fail" output.... goto EOF DOH!!! ![]() |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Programming > DOS Batch - User input (multiple words) to create folder name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|