Computing.Net > Forums > Programming > Space in filename

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Space in filename

Reply to Message Icon

Name: lw1990
Date: June 26, 2009 at 09:35:42 Pacific
OS: Windows server 2003
Subcategory: Batch
Comment:

Hi,
I'm running a batch file to delete some old log files in the "Microsoft SQL Server" folder. It works fine when I test it in a short path like "C:\testfolder", but if I use the path with a space in the folder name like this "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\LOG200", it will not delete the file. The message showing:"The system cannot find the file in C:|Program ". That means the program ignored the path after the space if the folder name. So how can I work with the space in the path of the file in batch program?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: June 26, 2009 at 12:04:38 Pacific
Reply:

Embrace the path/filename between double quotes ("), i.e.

"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\LOG200"

I'm quite surprised you ignore that rule introduced since Windows 95.

0

Response Number 2
Name: lw1990
Date: June 26, 2009 at 14:47:37 Pacific
Reply:

Yes, the path\filename is embraced in the double quotes as I said in the comment. But it is ignored by the batch processing.

Thanks.


0

Response Number 3
Name: Mechanix2Go
Date: June 26, 2009 at 17:52:32 Pacific
Reply:

Posted here and in DOS. LOL

Neither shows the bat.


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: phongphanp
Date: July 1, 2009 at 04:39:28 Pacific
Reply:

I think WINDOWS had more complex in security than DOS, if you know the method such as New file format that can difference from FAT , FAT32 , HTFS
,I think you may study formating also.

Doing any in DOS is a good thing for batch file programming


0

Response Number 5
Name: Mechanix2Go
Date: July 1, 2009 at 05:09:27 Pacific
Reply:

That clears it right up.


=====================================
If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Space in filename

remove spaces in multiple filenames www.computing.net/answers/programming/remove-spaces-in-multiple-filenames/14892.html

trimming spaces in a string www.computing.net/answers/programming/trimming-spaces-in-a-string/1025.html

Unwanted spaces in NS 4.7 www.computing.net/answers/programming/unwanted-spaces-in-ns-47/4919.html