I am trying to help someone create a batch file that takes a positional parameter (which specifies a drive letter) and if present checks to see if it contains a colon character. If not it appends one.
I just cannot get this to work. Here's what I have
SET V_DRIVE=%1
IF "%V_DRIVE%" == "" SET V_DRIVE=C:
ECHO %V_DRIVE% | FIND ":" > NUL
IF NOT ERRORLEVEL 1 SET V_DRIVE=%V_DRIVE%:
ECHO V_DRIVE=[%V_DRIVE%]
I've been searching for techniques all day long and I know I must be missing something simple. Can anyone PLEASE reply with just how one can achieve this?
Thanks all - B
I just cannot get this to work. Here's what I have
SET V_DRIVE=%1
IF "%V_DRIVE%" == "" SET V_DRIVE=C:
ECHO %V_DRIVE% | FIND ":" > NUL
IF NOT ERRORLEVEL 1 SET V_DRIVE=%V_DRIVE%:
ECHO V_DRIVE=[%V_DRIVE%]
I've been searching for techniques all day long and I know I must be missing something simple. Can anyone PLEASE reply with just how one can achieve this?
Thanks all - B