FOR Statement in Batch mode

G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

Hi all,
I have a dilemma. I am trying to assign security using the CACLS
command in WinNT4.0. I am calling a list of file names from a text file.
The script works for the most part except the folder names have a space in
them. I.E.

LastName - FI

When I run the script, the batch file only picks up the LastName value, it
doesn't get the whole word so of course the security is not applied
correctly because it can't find the correct folder.

My question, does anyone know how to capture the entire string from the text
file?. I tried surrounding the value with quotes (VB Trick) but that did
not work either.

Any help would be great!
TIA
RC-
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

RC- wrote:

> Hi all,
> I have a dilemma. I am trying to assign security using the CACLS
> command in WinNT4.0. I am calling a list of file names from a text file.
> The script works for the most part except the folder names have a space in
> them. I.E.
>
> LastName - FI
>
> When I run the script, the batch file only picks up the LastName value, it
> doesn't get the whole word so of course the security is not applied
> correctly because it can't find the correct folder.
>
> My question, does anyone know how to capture the entire string from the text
> file?. I tried surrounding the value with quotes (VB Trick) but that did
> not work either.
>
> Any help would be great!
> TIA
> RC-
>
>

for /f "delim=" %%n in (c:\boot.ini) do echo %%n
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

Thanks for the quick reply, but now, I keep getting the error:

%%n was unexpected at this time

Not sure what I'm doing wrong...

"Rob Stow" <rob.stow@sasktel.net> wrote in message
news:OVZS2WMHEHA.688@tk2msftngp13.phx.gbl...
> RC- wrote:
>
> > Hi all,
> > I have a dilemma. I am trying to assign security using the CACLS
> > command in WinNT4.0. I am calling a list of file names from a text
file.
> > The script works for the most part except the folder names have a space
in
> > them. I.E.
> >
> > LastName - FI
> >
> > When I run the script, the batch file only picks up the LastName value,
it
> > doesn't get the whole word so of course the security is not applied
> > correctly because it can't find the correct folder.
> >
> > My question, does anyone know how to capture the entire string from the
text
> > file?. I tried surrounding the value with quotes (VB Trick) but that
did
> > not work either.
> >
> > Any help would be great!
> > TIA
> > RC-
> >
> >
>
> for /f "delim=" %%n in (c:\boot.ini) do echo %%n
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

Nevermind, I figured it out.
The command is actually "delims=", the S was missing off of delims ' -)

Thanks for pointing me in the right direction!!

RC

"Rob Stow" <rob.stow@sasktel.net> wrote in message
news:OVZS2WMHEHA.688@tk2msftngp13.phx.gbl...
> RC- wrote:
>
> > Hi all,
> > I have a dilemma. I am trying to assign security using the CACLS
> > command in WinNT4.0. I am calling a list of file names from a text
file.
> > The script works for the most part except the folder names have a space
in
> > them. I.E.
> >
> > LastName - FI
> >
> > When I run the script, the batch file only picks up the LastName value,
it
> > doesn't get the whole word so of course the security is not applied
> > correctly because it can't find the correct folder.
> >
> > My question, does anyone know how to capture the entire string from the
text
> > file?. I tried surrounding the value with quotes (VB Trick) but that
did
> > not work either.
> >
> > Any help would be great!
> > TIA
> > RC-
> >
> >
>
> for /f "delim=" %%n in (c:\boot.ini) do echo %%n
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

RC- wrote:

> Thanks for the quick reply, but now, I keep getting the error:
>
> %%n was unexpected at this time
>
> Not sure what I'm doing wrong...
>
> "Rob Stow" <rob.stow@sasktel.net> wrote in message
> news:OVZS2WMHEHA.688@tk2msftngp13.phx.gbl...
>
>>RC- wrote:
>>
>>
>>>Hi all,
>>> I have a dilemma. I am trying to assign security using the CACLS
>>>command in WinNT4.0. I am calling a list of file names from a text
>
> file.
>
>>>The script works for the most part except the folder names have a space
>
> in
>
>>>them. I.E.
>>>
>>>LastName - FI
>>>
>>>When I run the script, the batch file only picks up the LastName value,
>
> it
>
>>>doesn't get the whole word so of course the security is not applied
>>>correctly because it can't find the correct folder.
>>>
>>>My question, does anyone know how to capture the entire string from the
>
> text
>
>>>file?. I tried surrounding the value with quotes (VB Trick) but that
>
> did
>
>>>not work either.
>>>
>>>Any help would be great!
>>>TIA
>>>RC-
>>>
>>>
>>
>>for /f "delim=" %%n in (c:\boot.ini) do echo %%n
>

Enough with that idiotic top posting already, OK ?

Typo. Should have been:
for /f "delim==" %%n in (c:\boot.ini) do echo %%n
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

RC- wrote:

> "Rob Stow" <rob.stow@sasktel.net> wrote in message
> news:OVZS2WMHEHA.688@tk2msftngp13.phx.gbl...
>
>>RC- wrote:
>>
>>
>>>Hi all,
>>> I have a dilemma. I am trying to assign security using the CACLS
>>>command in WinNT4.0. I am calling a list of file names from a text
>
> file.
>
>>>The script works for the most part except the folder names have a space
>
> in
>
>>>them. I.E.
>>>
>>>LastName - FI
>>>
>>>When I run the script, the batch file only picks up the LastName value,
>
> it
>
>>>doesn't get the whole word so of course the security is not applied
>>>correctly because it can't find the correct folder.
>>>
>>>My question, does anyone know how to capture the entire string from the
>
> text
>
>>>file?. I tried surrounding the value with quotes (VB Trick) but that
>
> did
>
>>>not work either.
>>>
>>>Any help would be great!
>>>TIA
>>>RC-
>>>
>>>
>>
>>for /f "delim=" %%n in (c:\boot.ini) do echo %%n
>
>
>

[Top posting fixed]

> Nevermind, I figured it out.
> The command is actually "delims=", the S was missing off of delims ' -)
>
> Thanks for pointing me in the right direction!!
>

Ummm ... I missed the missing S. What I caught was the missing
equal sign: "delims=="