If all you want is to request the URL and if it needs to be done from batch file, without anything outside of the OS, this can help you:
@if (@This==@IsBatch) @then
@echo off
rem **** batch zone *********************************************************
setlocal enableextensions disabledelayedexpansion
rem The batch file will delegate all the work to the script engine
if not "%~1"=="" (
wscript //E:JScript "%~dpnx0" %1
)
rem End of batch file area. Ensure the batch file ends execution
rem before reaching the JavaScript zone
exit /b
@end
// **** JavaScript zone *****************************************************
// Instantiate the needed component to make URL queries
var http = WScript.CreateObject('Msxml2.XMLHTTP.6.0');
// Retrieve the URL parameter
var url = WScript.Arguments.Item(0)
// Make the request
http.open("GET", url, false);
http.send();
// All done. Exit
WScript.Quit(0);
It is just a hybrid batch/JavaScript file and is saved as callurl.cmd
and called as callurl "http://www.google.es"
. It will do what you ask for. No error check, no post, just a skeleton.
If it is possible to use something outside of the OS, wget
or curl
are available as Windows executables and are the best options available.
If you are limited by some kind of security policy, you can get the Internet Information Services (IIS) 6.0 Resource Kit Tools. It includes tinyget
and wfetch
tools that can do what you need.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…