12 pages: [1] [2] [3] [4] [5]
HostWeb Forums » Microsoft Server Operating Systems » microsoft.public.win2000.cmdprompt.admin » how to write this for loop?
Topic: Re: how to write this for loop?
On Mon, 5 May 2008 07:58:48 -0700 (PDT), thinktwice <memorialday@gmail.com>
wrote:
@echo off
setlocal EnableDelayedExpansion
set variable=oldvalue
for ... in (....) do (
set variable=newvalue
command1 !variable!
command2 !variable!
....
commandn !variable!)
set variable=oldvalue
>but if command1-n depend on the value of variablen, it doesn't work.
>cause when it runs to commandn, it still use the oldvalue. how to
>write this for loop ?
Replies below ↓
Replies
Re: how to write this for loop?
On Mon, 5 May 2008 07:58:48 -0700 (PDT), thinktwice <memorialday@gmail.com>
wrote:
@echo off
setlocal EnableDelayedExpansion
set variable=oldvalue
for ... in (....) do (
set variable=newvalue
command1 !variable!
command2 !variable!
....
commandn !variable!)
set variable=oldvalue
>but if command1-n depend on the value of variablen, it doesn't work.
>cause when it runs to commandn, it still use the oldvalue. how to
>write this for loop ?
Re: how to write this for loop?
On Mon, 5 May 2008 07:58:48 -0700 (PDT), thinktwice <memorialday@gmail.com>
wrote:
@echo off
setlocal EnableDelayedExpansion
set variable=oldvalue
for ... in (....) do (
set variable=newvalue
command1 !variable!
command2 !variable!
....
commandn !variable!)
set variable=oldvalue
>but if command1-n depend on the value of variablen, it doesn't work.
>cause when it runs to commandn, it still use the oldvalue. how to
>write this for loop ?
Re: how to write this for loop?
On Mon, 5 May 2008 07:58:48 -0700 (PDT), thinktwice <memorialday@gmail.com>
wrote:
@echo off
setlocal EnableDelayedExpansion
set variable=oldvalue
for ... in (....) do (
set variable=newvalue
command1 !variable!
command2 !variable!
....
commandn !variable!)
set variable=oldvalue
>but if command1-n depend on the value of variablen, it doesn't work.
>cause when it runs to commandn, it still use the oldvalue. how to
>write this for loop ?
Re: how to write this for loop?
On Mon, 5 May 2008 07:58:48 -0700 (PDT), thinktwice <memorialday@gmail.com>
wrote:
@echo off
setlocal EnableDelayedExpansion
set variable=oldvalue
for ... in (....) do (
set variable=newvalue
command1 !variable!
command2 !variable!
....
commandn !variable!)
set variable=oldvalue
>but if command1-n depend on the value of variablen, it doesn't work.
>cause when it runs to commandn, it still use the oldvalue. how to
>write this for loop ?