for to set=


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).
 
Ad

Advertisements

T

T Lavedas

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/
 
F

foxidrive

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.
 
A

Al Dunbar

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/
 
B

billious

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....
 
A

Al Dunbar

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
 
Ad

Advertisements

B

billious

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...
 
J

Jean Pierre Daviau

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?
 
Ad

Advertisements

T

Todd Vargo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

set /a 1
set /a 13
set /a and vars 1
Set problem 3
set date 3
setting variable 12
set /a question 3
Set /a switch 9

Top