Re: For Command and Sys Variables
From: Tom Sibley (tsibley_at_tnp-online.com)
Date: 05/12/04
- Next message: Al Dunbar [MS-MVP]: "Re: Determining PUSHD levels"
- Previous message: Phil Robyn [MVP]: "Re: For Command and Sys Variables"
- In reply to: Phil Robyn [MVP]: "Re: For Command and Sys Variables"
- Next in thread: guard: "Re: For Command and Sys Variables"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 May 2004 13:06:30 -0500
It's always the simple stuff the comes back to bite up - THANKS.
"Phil Robyn [MVP]" <zipprobyn@berkeley.edu> wrote in message
news:ehpo4gEOEHA.1348@TK2MSFTNGP12.phx.gbl...
> Tom Sibley wrote:
>
> > I need to pull apart a variable. I know it's my lack of understanding
with
> > the FOR command that's holding me back, so if anyone knows of a good web
> > site that explains FOR better then FOR /?, please let me know.
> >
> > System variable is %USERNAME% (FName_LName)
> > The deliminator is "_"
> > I want to convert FName to one variable and LName to another variable.
I
> > will later be using the two variables to create a folder name.
> >
> > For /f "Tokens=1-2 Delims=_ " %%a in ('%USERNAME%') do (Set FName=%%a&
Set
> > LName=%%b)
> > If Exist _%FName%-%LName% Goto :End
> > MD _%FName%-%LName%
> >
> >
>
> Use double quotes instead of apostrophes:
>
> For /f "Tokens=1-2 Delims=_" %%a in ("%USERNAME%") do ...
>
> --
> Phil Robyn
> Univ. of California, Berkeley
>
> u n z i p m y a d d r e s s t o s e n d e - m a i l
- Next message: Al Dunbar [MS-MVP]: "Re: Determining PUSHD levels"
- Previous message: Phil Robyn [MVP]: "Re: For Command and Sys Variables"
- In reply to: Phil Robyn [MVP]: "Re: For Command and Sys Variables"
- Next in thread: guard: "Re: For Command and Sys Variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|