Hi I have this script Code: @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 that should check the validity of directory names (with absolute path) and file in Windows 7 and above and save these elements in the respective variables. I noticed that if I insert some valid directories or files but non-existent, the values of these elements are not saved in these variables. Why? The validity of these values is used to make sure that the creation of these elements have always success using the above variables with the md and oscdimg commands. So, how can I modify this script? Thanks Bye
I believe because of this line: Code: if not exist "%input%" set "invalid=The Path you specified for %~1 ^("%input%"^) does not exist." Please, try to explain exactly what do you want. Like if you hadn't a script. cheers
So, how do I save even the absolute path of the directories that this script will have to create them by checking, however, whether their syntax is valid for Wwindows 7 and above. My request is to avoid mistakes during their creation by using their respective variables. Thanks Bye
balubeto Did you try this: FileNameValidator? It does what you are looking for, and more... I don't think the code you posted will be simpler once all restrictions are counted in.