Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending variables to batch programs

Status
Not open for further replies.

AkiraKenshin

Programmer
May 18, 2005
17
CA
IF i have a variable (more specifically, one inside a for loop), can I send that variable to a nested program using call so that program can use it? I'm currently trying to place files in the fight folder, because VSS only allows retrieving files into the folder that the batch file is invoking from, so I've figured out how to make the directories they go into, but I'll need the second batch program to actualyl run VSS inside each directory. However each VSS has a different parameter, where the list is kept in a text file. So i need to send that parameter that I've already extracted frmo the first batch file into the second.

Any help would be appreciated.
 
Yes.

Use in the command syntax

FOR /G %%i IN (list) CALL second.bat %%i

In second.bat the first available variable %1 is then equal to %%i
 
Thanks, that was most helpful, but I realize now that I have to be writing a batch file within a batch file in second.bat, but i'll post that separately here
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top