打开使用批处理文件链接在自定义大小的浏览器窗口 [英] Opening Link using batch file in browser window of custom size

查看:709
本文介绍了打开使用批处理文件链接在自定义大小的浏览器窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个批处理文件,这将打开一个应用程序和一个链接。我们的想法是使用这个批处理文件快捷方式文件在桌面上,这样在点击应用程序和URL链接例如www.google.com应该打开,但浏览器的大小应该是定制即例如600 * 600

请提示

 关闭@echo开始的test.exe启动www.google.com出口


解决方案

启动命令可以启动Windows最大化,而不是缩放到特定大小。和浏览器的安全性将prevent从目标网页的code范围内使用JavaScript来调整客户端窗口。

最好的办法是使用 InternetExplorer.Application COM对象与Internet Explorer窗口进行交互,而不是试图操纵用户未知的默认浏览器。

下面是一个可能的解决方案。以.bat扩展名保存并运行它,看看会发生什么。

<! - //批/ HTA混合脚本关闭@echo开始的calc.exeREM //调用HTA嵌合体VBScript的
MSHTA%〜F0REM // END主要运行
GOTO:EOF// HTA嵌合体 - >
< SCRIPT LANGUAGE =VBSCRIPT>设置IE =的CreateObject(InternetExplorer.Application)IE.navigate2http://stackoverflow.com/
IE.width = 600
IE.height = 600
IE.visible =真关()< / SCRIPT>

您也可以使用 InternetExplorer.Application COM用的的JScript混合 PowerShell的脚本,如果你preFER。

I want to create a batch file which will open one application and one link. The idea is to use this batch file in the shortcut file on desktop so that on one click the application and the URL link example www.google.com should open but the browser size should be custom i.e for example 600*600

Please suggest

@echo off

start test.exe

start www.google.com

exit

解决方案

The start command can start windows maximized, but not scaled to a specific size. And browser security will prevent you from using JavaScript within the target web page's code to resize the client window.

Best bet is to use the InternetExplorer.Application COM object to interact with an Internet Explorer window, rather than attempting to manipulate the user's unknown default browser.

Here's one possible solution. Save it with a .bat extension and run it to see what happens.

<!-- // batch / HTA hybrid script

@echo off

start calc.exe

rem // invoke HTA chimera for VBScript
mshta "%~f0"

rem // end main runtime
goto :EOF

// HTA chimera -->
<script language="VBscript">

Set IE = CreateObject("InternetExplorer.Application")

IE.navigate2 "http://stackoverflow.com/"
IE.width = 600
IE.height = 600
IE.visible = true

close()

</script>

You could also interact with the InternetExplorer.Application COM object with a JScript hybrid or Powershell script if you prefer.

这篇关于打开使用批处理文件链接在自定义大小的浏览器窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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