There are times when I need a Windows program that performs an outside function to simply access a website with a particularly formed URL. Many times, these programs do not have an option to “touch” a URL. By touch, I am referencing the touch command in Linux which creates an empty file. Sometimes I need to touch something like http://www.somewebsite.com/folder/update.php?q=Update. I could use wget for Windows, but why do that when I could use a built-in function of Windows. I wrote a VB Script that simply “gets” a URL and exits.
' httptouch.vbs ' Created by Jason C. Greb ' http://www.electronerdz.com/ Set Args = WScript.Arguments URL = Args(0) ' Read argument (must be in quotes) Set oHTTP = CreateObject("MSXML2.XMLHTTP") oHTTP.Open "GET", URL, False oHTTP.Send() ' Send to the server 'Wscript.Echo oHTTP.Status ' Output the status if you'd like Set oHTTP = Nothing
This script takes an argument after it, in quotes, and accesses that URL, then quits. You can add it to your program that runs an external program and put the argument after it. Keep in mind that you may need to reference the cscript.exe file (usually in system32) then the script, then the argument.