打开一个URL,而不使用浏览器从一个批处理文件 [英] Open a URL without using a browser from a batch file

查看:435
本文介绍了打开一个URL,而不使用浏览器从一个批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开一个特定的URL,而不直接打开只使用一个批处理文件浏览器。我知道我可以使用这样的:

I want to open a particular URL without opening directly the browser using only a batch file. I know i can use something like:

    START www.google.com 

但我想打开一个URL,而不使用浏览器。这可能吗?其原因是,我有像30的URL打开,我不希望用户有像30卡在他的电脑中打开。

but i want to open a URL without using a browser. Is this possible? The reason is that i have to open like 30 URL's and i don't want the user to have like 30 tabs opened in his pc.

推荐答案

如果你想要的是请求的URL,如果它需要从批处理文件完成,无需任何操作系统之外,这可以帮助你

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 Batch file will delegate all the work to the script engine 
    if not "%~1"=="" (
        wscript //E:JScript "%~dpnx0" %1
    )

    rem End of batch area. Ensure batch ends execution before reaching
    rem 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);

这仅仅是一个混合批次/ JavaScript文件。保存为 callurl.cmd 并称为 callurlhttp://www.google.es它会做什么你问。没有错误校验,无后,只是一个骨架。

It is just an hybrid batch/javascript file. 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.

如果有可能使用的东西操作系统,的wget 卷曲之外的可作为Windows可执行文件和是最好的选项。

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.

如果您通过某种安全政策的限制,你可以得到 Internet信息服务(IIS)6.0 Resource Kit工具的。它包括 tinyget wfetch 工具比可以做你所需要的。

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 than can do what you need.

这篇关于打开一个URL,而不使用浏览器从一个批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆