Computing.Net > Forums > Programming > Accessing Folder names with a space

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.

Accessing Folder names with a space

Reply to Message Icon

Name: Gods
Date: October 14, 2009 at 01:50:51 Pacific
OS: Windows XP
CPU/Ram: 2.992 GHz / 1021 MB
Product: Dell / Optiplex gx270
Subcategory: Batch
Comment:

The code below tries ti access a file from the folder , and the folder name has space and hence i dont get any output or error message... nothin jus happens... if i place the file in anyother folder that has spaces inbetween then it works totally fine . I tried double quotes also but without any change.Can you please let me know the reason and suggest an alternate.

@echo off > newfile & setLocal enableDELAYedexpansion

set N=
for /f "tokens=* delims= " %%a in (C:\Data\test rest pans\myfile) do (
set /a N+=1
)
set /a X=!N!-10
set N=

for /f "tokens=* delims= " %%a in (C:\Data\test rest pans\myfile) do (
set /a N+=1
if !N! gtr !X! echo %%a >> newfile
)



Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: October 14, 2009 at 02:31:19 Pacific
Reply:

for /f "usebackq tokens=* delims= " %%a in ("C:\Data\test rest pans\myfile") do (

Without usebackq double quotes are interpreted as literal strings.

see "start > run > cmd > for /?" for more info.


Batch Variable how to


0

Response Number 2
Name: Gods
Date: October 14, 2009 at 02:42:29 Pacific
Reply:

Quotes doesnt work... its is not takin up the file ...


0

Response Number 3
Name: Judago
Date: October 14, 2009 at 02:55:13 Pacific
Reply:

Did you use the "usebackq" option that I mentioned above?


Batch Variable how to


0

Response Number 4
Name: Gods
Date: October 14, 2009 at 03:39:41 Pacific
Reply:

yes ... the usebackq is wrking perfectly thanks a lot !!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Accessing Folder names with a space

windows xp batch file, edit ....... www.computing.net/answers/programming/windows-xp-batch-file-edit-/9278.html

Replace space in folder names www.computing.net/answers/programming/replace-space-in-folder-names/16936.html

Make and rename a folder in batch www.computing.net/answers/programming/make-and-rename-a-folder-in-batch/15647.html