Searching for file owners, but struggling with space in name
Posted: 23 Apr 2008 07:22
Hi there,
i am just writing a simple script to go through a given list of file names (the list is in a txt file), performing a DIR /q into it and sending the results to an output file.
for /F %%i IN (confidentiallist.txt) do dir /q %%i >> owner-confidential.txt
The issue i am facing when running the batch file is that, whenever a file or folder has a space in it, the command is broken and not performed accordingly. Ex: if the input file has such a file -
c:program file\icq\icq60.exe
the result i get is:
DIR C:\Program
File not found
which means that everything after the space is being ignored. I tried to put the whole parameter in double quotes, such as
"c:\program files\icq\icq60.exe", but still getting the same error.
I know it might be piece of cake for you guys, but i am struggling with it for quite some time, and haven't found a clear answer to this issue.
Regards,
Adriano.
i am just writing a simple script to go through a given list of file names (the list is in a txt file), performing a DIR /q into it and sending the results to an output file.
for /F %%i IN (confidentiallist.txt) do dir /q %%i >> owner-confidential.txt
The issue i am facing when running the batch file is that, whenever a file or folder has a space in it, the command is broken and not performed accordingly. Ex: if the input file has such a file -
c:program file\icq\icq60.exe
the result i get is:
DIR C:\Program
File not found
which means that everything after the space is being ignored. I tried to put the whole parameter in double quotes, such as
"c:\program files\icq\icq60.exe", but still getting the same error.
I know it might be piece of cake for you guys, but i am struggling with it for quite some time, and haven't found a clear answer to this issue.
Regards,
Adriano.