Boskop
asked on
'IF EXIST' in a .bat script to test for an empty directory
I would like to test if an directory is empty, using a simple batch script.
I wrote the following line:
if not exist "%ProgramFiles%\Epos9300\n
My Problem is:
I want to run this batch file in Windows XP operating systems with different languages.
For example in the English windows version the system variable %ProgramFiles% includes a white space. (...\Program Files\...)
Therefore I must put the whole path into double quotas.
But with double quotas the 'exist' command does not recognize an empty directory anymore.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternatively, use the valid shortname for %ProgramFiles% - e.g. C:\Progra~1\
ASKER
mkdonohue, it's a good idea. Maybe there is one other suggestion to do it without changing the current path.
smilingpolitely, with your solution it is not sure that this is the real path name. Maybe it's C:\Progra~2\ or C:\Whewhe~1\ in another language like suaheli.
smilingpolitely, with your solution it is not sure that this is the real path name. Maybe it's C:\Progra~2\ or C:\Whewhe~1\ in another language like suaheli.