for to set=

  • Thread starter Thread starter Jean Pierre Daviau
  • Start date Start date
J

Jean Pierre Daviau

Hey, ho,

for %i in (*.c) do call :RECURSE %%i
goto print
:RECURSE
setlocal
%_file%=%_file% %i
endlocal & set _file=%_file%
:PRINT
@echo %_file%
:EOF

Jean Pierre Daviau

-------
HP Pavilion Elite m9525f Desktop PC
Vista Édition Familiale Premium SP1 64 bits
pont sud Intel 8280 (ICH9R)
Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
C'est un Intel 64 (EM64T), qui est une architecture x86-64 (comme l' AMD64).
 
Hey, ho,

for  %i in (*.c) do call :RECURSE %%i
goto print
:RECURSE
setlocal
%_file%=%_file% %i
endlocal & set _file=%_file%
:PRINT
@echo %_file%
:EOF

                            Jean Pierre Daviau

-------
HP Pavilion Elite m9525f Desktop PC
Vista Édition Familiale Premium SP1  64 bits
pont sud Intel 8280 (ICH9R)
Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
C'est un Intel 64 (EM64T), qui est une architecture x86-64 (comme l' AMD64).

I'm not certain what you are asking, but I do see some problems ...

for %%i in (*.c) do call :RECURSE %%i
:: ^ missing percent sign
goto print
:RECURSE
Rem setlocal - this is not needed
set _file=%_file% %1
rem the variables in the subroutine are the same as at the command
line - %1, not %%i
REM endlocal & set _file=%_file% - this is not needed
:PRINT
@echo %_file%
:EOF

Another way to do this is ...

for %%i in (*.c) do call set _file=%%_file%% %%i
@echo %_file%

Be warned, though, that the command line can only process a command of
1024 characters or less. So, long file lists may fail.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
 
You have more patience than me Tom, I skipped the post coz there was no
explanatory text.
Be warned, though, that the command line can only process a command of
1024 characters or less. So, long file lists may fail.

On this point: I've seen microsoft pages that say W2K has a 2K cmd line
limit and XP has an 8K cmd line limit.
 
Hey, ho,

for %i in (*.c) do call :RECURSE %%i
goto print
:RECURSE
setlocal
%_file%=%_file% %i
endlocal & set _file=%_file%
:PRINT
@echo %_file%
:EOF

Jean Pierre Daviau

-------
HP Pavilion Elite m9525f Desktop PC
Vista Édition Familiale Premium SP1 64 bits
pont sud Intel 8280 (ICH9R)
Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
C'est un Intel 64 (EM64T), qui est une architecture x86-64 (comme l'
AMD64).

I'm not certain what you are asking, but I do see some problems ...

for %%i in (*.c) do call :RECURSE %%i
:: ^ missing percent sign
goto print
:RECURSE
Rem setlocal - this is not needed
set _file=%_file% %1
rem the variables in the subroutine are the same as at the command
line - %1, not %%i
REM endlocal & set _file=%_file% - this is not needed

===> but without a "goto:eof", any call to the recurse subroutine will
effectively fall through into the print subroutine.

:PRINT
@echo %_file%
:EOF

===> and the explicit ":eof" label should not be here.

/Al

Another way to do this is ...

for %%i in (*.c) do call set _file=%%_file%% %%i
@echo %_file%

Be warned, though, that the command line can only process a command of
1024 characters or less. So, long file lists may fail.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
 
T said:
I'm not certain what you are asking, but I do see some problems ...

for %%i in (*.c) do call :RECURSE %%i
Rem setlocal - this is not needed
set _file=%_file% %1
rem the variables in the subroutine are the same as at the command
line - %1, not %%i
REM endlocal & set _file=%_file% - this is not needed

Another way to do this is ...

for %%i in (*.c) do call set _file=%%_file%% %%i
@echo %_file%

Be warned, though, that the command line can only process a command of
1024 characters or less. So, long file lists may fail.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/

The "> label" idea also seems a little odd. Since there's a clear "call
:RECURSE" it doesn't appear to be a problem with fonts and ":" - and a label
"EOF" is redundant in NT+.

OTOH, it is a certain day of the year....
 
billious said:
The "> label" idea also seems a little odd. Since there's a clear "call
:RECURSE" it doesn't appear to be a problem with fonts and ":" - and a
label "EOF" is redundant in NT+.

OTOH, it is a certain day of the year....

Not yet, not here at least!

/Al
 
Al Dunbar said:
Not yet, not here at least!

/Al

Oooh - looky-looky!

OE-Quotefix changes a leading colon on a line to a greater-than symbol....

Seems like one should only use it when OP uses one of those weirdo posting
methods....

So much for cleaning up the desktop...
 
Hi,
Yes I really wanted to create a line like that : Noname2.c Noname3.c
then gcc ..... Noname2.c Noname3.c


Thanks to all.
On this point: I've seen microsoft pages that say W2K has a 2K cmd line
limit and XP has an 8K cmd line limit.
A fake ? It is 1024 characters?
 
billious wrote:
....
Oooh - looky-looky!

OE-Quotefix changes a leading colon on a line to a greater-than
symbol....

Seems like one should only use it when OP uses one of those weirdo
posting methods....

So much for cleaning up the desktop...

Yes, I've mentioned about this some time ago in amb. Batch/cmdprompt and
ASCII Art groups are about the only groups where OE-Quotefix is going to be
of major concern.
 
Back
Top