@echo off echo Date: %Date% echo Time: %Time% dir C:\Sample content of PostResponse.htm:
<!DOCTYPE html><html><body><div style="color:red;"><pre>Note: string %output% will be replaced by standard output of Outp.bat
%output%
</pre></div></body></html>
@echo off type testpost\htmlstart.txt ipconfig /all type testpost\htmlend.txtSample content of htmlstart.txt:
<!DOCTYPE html><html><meta charset="UTF-8"><body><pre>Sample content of htmlend.txt:
</pre></body></html>Note:
computername0=A&company=ApplicGate&email=reinhold.leitner%40applicgate.comPOST:"TestPost\*$|.txt" ... name of file for POST data has a timestamp and the extension .txt
@echo off rem Remove quotes of input file name: FOR /F %%i IN (%1) DO set file=%%i rem Parse form data and set environment variables: FOR /F "delims=& tokens=1-3" %%i IN (%file%) DO SET %%i&SET %%j&SET %%k echo The license for computer %computername0% will be sent to %email%.Note: PostResponse.htm has the same content as in example 1 above
The license for computer A will be sent to reinhold.leitner@applicgate.com.
path=c%3A%5C&email=reinhold.leitner%40applicgate.comDirectory Example with Visual Basic Script: Dir.vbs
var stdin = WScript.StdIn; var stdout = WScript.StdOut; var objArgs = WScript.Arguments; stdout.WriteLine("<!DOCTYPE html><html><meta charset='UTF-8'><body><div style='color:blue;'>"); for (i = 0; i < objArgs.length; i++) { stdout.WriteLine("Argument " + i + ": " + objArgs(i) + "<BR>"); } while (!stdin.AtEndOfStream) { var str = stdin.ReadLine(); stdout.WriteLine("Line " + (stdin.Line - 1) + ": " + str + "<br>"); } stdout.WriteLine("</div></body></html>");
@echo off Rem Remove quotes of input: FOR /F "delims=&" %%i IN (%1) DO set mycmd=%%i echo %mycmd% %mycmd%Note: Special characters must be masked in URL, e.g. "\" --> "%5C"
reinhold.leitner@applicgate.com (C) December 2024 www.applicgate.com |