从 Win2008 上的批处理文件在浏览器中显示 Silverlight 应用程序 [英] Showing Silverlight App in Browser From batch file on Win2008

查看:29
本文介绍了从 Win2008 上的批处理文件在浏览器中显示 Silverlight 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Windows Server 2008 机器上的批处理文件中打开带有 Silverlight 应用程序的网页.

I am trying to open a web page with a Silverlight App from a batch file on a Windows Server 2008 box.

如果我把它放在批处理文件中:

If I put this in the batch file:

start iexplore http://www.google.com

谷歌页面显示.

如果我把它放在批处理文件中(TestPage 有一个 Silverlight 应用程序):

If I put this in the batch file (where TestPage has a Silverlight Application):

start iexplore http://www.mysite.com/Configure/TestPage.html

页面显示但带有下载 Silverlight"图标/链接.

the page shows but with the "Download Silverlight" icon/link.

如果我手动浏览到该页面,应用会显示.

If I browse to that page manually the app shows.

关于如何解决这个问题有什么想法吗?

Any ideas on how to get around this?

我正在尝试在我们的构建机器(Windows Server 2008 机器)上运行我的 Silverlight 测试(实际上使用 PowerShell,但症状相同,批处理文件更容易解释).

I am trying to run my Silverlight tests (actually using PowerShell but the symptoms are the same and a batch file is easier to explain) on a our build machine which is a Windows Server 2008 box.

看起来这是因为批处理脚本正在运行 64 位版本的 IE.当我以用户身份启动链接时,我获得了 32 位版本.

It looks like this is because the batch script is running the 64bit version of IE. When I launch the link as a user I get the 32bit version.

在我的 PoweShell 脚本中,我使用它来访问 IE:

In my PoweShell script I am using this to get to IE:

$ie = new-object -com "InternetExplorer.Application" 

-但它也获得了 64 位版本.

-but it too is getting the 64 bit version.

真的,我的问题变成了如何通过 COM 访问 32 位版本的 IE?

So really, my question has become how do I get to the 32 bit version of IE via COM?

推荐答案

我偶然发现了一个简单的方法来解决这个问题.我从

I stumbled upon an easy way around this. I changed my calling script from

        <Exec IgnoreExitCode="True" Command="powershell 
.\RunSilverlightTests.ps1 '$(DeploymentAddress)\TestPage.html'" >

        <Exec IgnoreExitCode="True" Command="%windir%\SysWoW64\cmd.exe /C 
powershell "& '.\RunSilverlightTests.ps1' 
'$(DeploymentAddress)/TestPage.html'"" >

这将在 WOW(Windows on Windows = 32bit)版本中运行脚本命令行:因此 PowerShell 自动提供 32 位版本的dll.

This runs the script in the WOW (Windows on Windows = 32bit) version of the command line: therefore PowerShell is automatically served 32bit version of dlls.

您可以从 %windir%\SysWoW64\cmd.exe 运行简单的批处理文件,它也可以运行.

You can run the simple batch file aboce from %windir%\SysWoW64\cmd.exe and it works too.

花了 3 天,但我到了那里 :)

Took 3 days, but I got there :)

干杯

标记

这篇关于从 Win2008 上的批处理文件在浏览器中显示 Silverlight 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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