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.


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.


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


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

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


Without seeing the format of your link it's not really possible to say yes or no. However, what you could do is pass the entire link as a parameter and have it parsed by the batch file itself to extract the bit of interest.


Any chance you could instead have the first script generate a temporary script that hard-codes the changing parameter, and then just send out an e-mail with a link to the temporary copy of the script?

Otherwise, I'm not sure of any obvious ways to include "parameters" in a URL pointing to a script.

(Did I understand your request?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.