是否可以显示网页的HTML code在批处理文件? [英] Is it possible to display the HTML Code of a webpage in a batch file?
问题描述
有关我的新节目,我想呼应网页的code。我搜索谷歌和堆栈溢出,但didn't发现这样的事情。我不想使用像URL2FILE或者像这样的外部程序。
For my new program I want to echo the code of a webpage. I searched on google and Stack Overflow but didn´t found something like this. I do not want to use external programs like URL2FILE or something like this.
推荐答案
这code是从previous问题只需要做查询到服务器(在评论的链接)的显示屏网页源代码的code补充说。
This code is from a previous question that only needed to do the query to the server (linked in comments) with the "display" of the page source code added.
@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"=="" (
cscript //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();
// If we get a OK from server (status 200), echo data to console
if (http.status === 200) WScript.StdOut.Write(http.responseText);
// All done. Exit
WScript.Quit(0);
这仅仅是一个混合批次/ JavaScript文件。保存为 callurl.cmd
并称为 callurlhttp://www.google.es
它会做什么你问。没有错误检查APPART从正确的反应,无后,只是一个骨架。
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 appart from correct response, no post, just a skeleton.
这篇关于是否可以显示网页的HTML code在批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!