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?

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 5/5/2008 9:38:16 AM

By: foxidrive
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

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 5/5/2008 9:38:16 AM

By: foxidrive

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 ?

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 5/5/2008 9:38:16 AM

By: foxidrive

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 ?

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 5/5/2008 9:38:16 AM

By: foxidrive

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 ?

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 5/5/2008 9:38:16 AM

By: foxidrive

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 ?

Contents
Home
Forums
About Us
Contact Us
Web Hosting:
Hosting Providers
How to choose a name
What is a Hosting Provider
Hosting Types
Choosing the right plan
 
Search
 
Login to HostWeb.com
Email
Password
If you do not have an account with us yet, join now - it's FREE!