Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer

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?)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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