You should precise what you want to do... .balubeto wrote:Does anyone know how to solve my problem in a more suitable form?
Maybe something like this may help you (but that's just guessed):
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
call :setValidPath "Windows_Files_Path" "%~1" "Enter the directory in which put the content of the ""Windows Setup Media"" volume image:"
call :setValidPath "iso_Path" "%~2" "Enter the directory in which put the iso image file created:"
call :setValidPath "esd_File_Path" "%~3" "Enter the directory in which put the esd unencrypted file:"
call :setValidFile "esd_File" "%~4" "Enter the file to be converted which should be put in the %esd_File_Path% directory:"
echo(
echo Result:
echo Windows_Files_Path: "%Windows_Files_Path%"
echo iso_Path : "%iso_Path%"
echo esd_File_Path : "%esd_File_Path%"
echo esd_File : "%esd_File%"
:: put your code here
endlocal
goto :eof
:setValidPath
:: %~1 variable to set
:: %~2 default value
:: %~3 text if default value is invalid
setlocal
set "input=%~2"
set "text=%~3"
set "first=1"
:validatePath
set "invalid="
:: validating
:: example code for invalidating input if the given path does not exist
if not exist "%input%" set "invalid=The Path you specified for %~1 ^("%input%"^) does not exist."
:: insert code for additional validity checking
if not defined invalid endlocal & set "%~1=%input%" & echo Valid: %~1=%input%& goto :eof
echo(Invalid: %invalid%
set /P ^"input=%text:""="% "
goto :validatePath
:setValidFile
:: %~1 variable to set
:: %~2 default value
:: %~3 text if default value is invalid
setlocal
set "input=%~2"
set "text=%~3"
set "first=1"
:validateFile
set "invalid="
:: validating
:: example code for invalidating input if the given filename is empty string
if "" == "%input%" set "invalid=The Filename you specified for %~1 is the empty string."
:: insert code for additional validity checking
if not defined invalid endlocal & set "%~1=%input%" & echo Valid: %~1=%input%& goto :eof
echo(Invalid: %invalid%
set /P ^"input=%text:""="% "
goto :validateFile
penpen