psychedelic_fur Posted February 21, 2006 Posted February 21, 2006 Hi Friends,I have a requirement. In my development environment I start a batch file which opens a windows shell, setup some environment variables and before exiting opens up another shell with the environment set and default directory set. I then type in the required command to actually start working. This command takes in 7-8 parameters to start a required process. So my requirement is how do I automate this, I do not want to type in the command every time (or do a copy-paste to start working)You guys may say that put the command in the batch file and just execute once you are on your command prompt, but I do not want to do this. What I am really looking for is that I just click the mouse button, which starts a batch file and pass my command to the final shell opened by the batch file.Hope I am clear in what I am looking for.If anyone has a suggestion please let me know.Thanks and Regards.
jaclaz Posted February 21, 2006 Posted February 21, 2006 (edited) Hope I am clear in what I am looking for.No you are not, unless you need a hypothetical help instead of practical one.If you are not from CIA, NSA or the like, maybe you could disclose a couple of lines of your batch... However, you just execute the other batch file, invoking it with desired parameters, example::: This is batch #1 Batch_1.cmd:: Do whatever I am supposed to do:: do something else:: Set the path to the other batch file (if NOT in the same directory of Batch #1)Set Batch_2_path=C:\directory\Batches\Batch_2:: Set parameters needed for Batch_2:: ONLY needed if parameters are somewhat calculated before in batchSet param1=some_parameter_1Set param2=some_parameter_2Set param3=some_parameter_3Set param4=some_parameter_4Set param5=some_parameter_5Set param6=some_parameter_6Set param7=some_parameter_7Set param8=some_parameter_8:: now invoke Batch #2 passing parameters to itBatch_2_path\Batch_2.cmd %param1% %param2% %param3% %param4% %param5% %param6% %param7% %param8%:: otherwise just put the parameters on invoking lineBatch_2_path\Batch_2.cmd some_parameter_1 some_parameter_2 some_parameter_3 some_parameter_4 some_parameter_5 some_parameter_6 some_parameter_7 some_parameter_8 :: END of Batch #1:: This is batch #2 Batch_2.cmd:: The parameters are batch variables::: %0 name of Batch #2 (Batch_2.cmd in this case):: %1 parameter #1:: %2 parameter #2:: and so on:: If you want to recreate the same parametersSet param1=%1Set param2=%2Set param3=%3Set param4=%4Set param5=%5Set param6=%6Set param7=%7Set param8=%8:: Do whatever I am supposed to do:: do something else:: END of Batch #2Please note that in this case, Batch #1 will pass command to Batch #2, if you want to return to batch #1, you need to use the CALL statement:http://www.robvanderwoude.com/call.htmlas inCALL Batch_2_path\Batch_2.cmd %param1% %param2% etc.jaclaz Edited February 21, 2006 by jaclaz
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now