Jump to content

inherit variables


Recommended Posts


You want to change the values of %1 %2...? Or you want to reuse them a second time?

yes IcemanND I want to reuse them a second time :thumbup

pass them on to the next batch.bat that can use the same ones as inherited regardless to what they are ...

in theory it needs to retrieve 1 2 3 and some how pass them on initiating the next batch2.bat

thanks

Edited by sweept
Link to comment
Share on other sites

Here is a simple example:

Batch.bat


@echo off
::Batch.bat

Echo Running batch.bat...
echo Parameter #1: %1
echo Parameter #2: %2
echo Parameter #3: %3

call batch2.bat %1 %2 %3

echo batch.bat done!

Batch2.bat:


@echo off
::Batch2.bat

Echo Running batch2.bat...
echo Parameter #1: %1
echo Parameter #2: %2
echo Parameter #3: %3

echo batch2.bat done!

Place both files in the same directory.

Launch using the following command:

Batch.bat one two three

HTH

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...