Batch file link with parameters

batch-file

I have a script which generates an Email with information based on the computer it was just run on. In the Email there is also a link to another batch file (which runs an exe) that I would only need sometimes, said batch file needs to be executed via the link with a parameter which changes based on information pulled from the first script.

Now if you deciphered any of that, Congratulations.

What I need to know is, is this possible (to run a batch script with parameters from a link) and if so could anyone provide information on this.

Best Answer

That depends on what kind of data is in the parameters being passed. If it is simple text data, less than 256 characters, you can do so on the command line. Longer parameters may require using an environmental variable. Or worse, text files.

[FirstLevel.script]

SetWindowsEnvironment("CMDLongParm", $ResultString1);
SysCall("f:\batch\sub.cmd \"$ResultString2\"");

[sub.cmd]

@echo off
DoEmail %1 %CMDLongParm% >> Email.Log

Just some pseudo-code examples to show how it is done.