PC Review


Reply
Thread Tools Rate Thread

FOR Command in a batch file

 
 
pestrue@gmail.com
Guest
Posts: n/a
 
      16th Feb 2007
I have some old batch scripts I am trying to update to run on XP. My
problem is with the FOR Command where I had a line

for %%R in (*.doc) do set attachaas=!attachaas!,%%R

apparently the '!' doesn't do what it used to. I just need to get a
variable equal to

attachaas = '1.doc,2.doc,3.doc' etc.

Thanks

JP

 
Reply With Quote
 
 
 
 
Tom Porterfield
Guest
Posts: n/a
 
      16th Feb 2007
(E-Mail Removed) wrote:
> I have some old batch scripts I am trying to update to run on XP. My
> problem is with the FOR Command where I had a line
>
> for %%R in (*.doc) do set attachaas=!attachaas!,%%R
>
> apparently the '!' doesn't do what it used to. I just need to get a
> variable equal to
>
> attachaas = '1.doc,2.doc,3.doc' etc.


By default delayed variable expansion is off. You need to run cmd.exe with
the /V:ON switch to enable delayed variable expansion that will give the
behavior you want.
--
Tom Porterfield

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file works in command line but not as a batch Danger Windows XP General 7 5th Feb 2008 04:50 PM
Batch file command Windows XP General 2 14th Aug 2004 12:30 AM
AT command in a batch file JIM.H. Microsoft Windows 2000 CMD Promt 2 5th Dec 2003 10:53 AM
Re: batch file command guard Microsoft Windows 2000 CMD Promt 0 23rd Sep 2003 02:33 PM
Re: batch file command Torgeir Bakken (MVP) Microsoft Windows 2000 CMD Promt 0 23rd Sep 2003 02:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 PM.