1.

Solve : Find certain directory that has spaces in it's name.?

Answer»

I am making a batch file that searches for a certain folder and if it exists copies files to it.
MS-DOS does not search for a directory, but null device exists in every folder.
According to the Help file "if exist C:mydir\nul goto process" searches for the null device.

But WHENEVER there is a space in the folder name, it refuses to work.
Here is a tuned down version I ran as a test. It won't work either.

@=========
@ECHO off
If exist "c:\aa bb\nul" goto cont else goto knock

:knock
echo no folder
pause
exit

:cont
echo folder found
pause
exit
@========

If I take out the space it WORKS just fine, but the thing is: I need that space.
Can Anyone help me out here?
Kinda new to this stuff.

Greetings,
Dramklukkel

WinXP Pro, SP2use quote marks

"c:\path and\directory name with spaces"Hi Dias,

Thanks, but I did use these quotes. That's the frustrating PART of it. You shouldn't need the nul device in XP.

Code: [Select]If exist "c:\aa bb" goto cont else goto knock

searching for \nul is not advised on ntfs.
ROTFL.
The help file in XP told me to do just that. To search for the nul device.
You guys were right. It ONLY works perfectly well without it.

Thanks, both of you.
Dramklukkelalso, NT/2K/XP/2k3/Vista command prompt is NOT MS-DOS.
Quote from: Dias de verano on July 09, 2008, 08:29:37 AM

also, NT/2K/XP/2k3/Vista command prompt is NOT MS-DOS.

You're right. I meant CMD.


Discussion

No Comment Found