如何Windows 64bit里面运行32bit的脚本

在使用VBA call Jmail发邮件时发现在32bit系统没有问题的脚本,在64bit不能使用, Jmail免费版又没有64bit的,这时就有了如标题描述的问题.

如果你的脚本要依赖于32bit的COM 对象, 那么在转移到64bit时会发现对象无法创建. 这样我们需要在64bit里面 用可以解释32bit的脚本的解释器.

如果是.net application, 那么在编译时选择使用32bit编译就可以了

如果是IIS hosted application, 需要打开IIS的32bit兼容.

 

Key Word:windows 2008, 64bit, vba,jmail

Running 32bit dependent scripts in a 64bit world

Josh Poley

Bungie

11,025 Points 13 5 1
Recent Achievements
Blog Conversation Starter New Blog Rater New Blog Commentator
18 Sep 2008 1:44 PM

 

As seen earlier, it can be problematic to run scripts which rely on 32bit COM objects on a 64bit platform. To make things easier, I wrote basic some script code to detect that the wrong scripting host was run and fork out to the correct one. This just uses a variation of the "detect cscript vs. wscript" pattern, but instead we look at the current processor and do a check to see if we are running the wrong flavor of the script host.

 

//

// this script code relies on 32bit COM objects, if we are running on

// a 64bit system we will want to run under WOW64 (the x86 emulator).

//

 

var shell = WScript.CreateObject("WScript.Shell");

var cpu = shell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%").toLowerCase();

var host = WScript.FullName.toLowerCase();

 

// check to see if we are on an AMD64 processor and running the

// wrong version of the scripting host.

if(host.indexOf("system32") != -1 && cpu == "amd64")

    {

    var syswow64Host = host.replace(/system32/g, "syswow64");

    var newCmd = syswow64Host + " \"" +

        WScript.ScriptFullName + "\" //Nologo";

 

    // ATTEMPT to pass all the same command

    //  line args to the new process

    var args = WScript.Arguments;

    for(i=0; i<args.length; i++)

        newCmd += " " + args(i);

 

    WScript.Echo("Running the syswow64 bit version instead...\n  " +

        newCmd + "\n");

 

    // launch the new script and echo all the output

    var exec = shell.Exec(newCmd);

    while(exec.Status == 0)

        {

        if(!exec.StdOut.AtEndOfStream)

            WScript.Echo(exec.StdOut.ReadAll());

        WScript.Sleep(100);

        }

 

    if(!exec.StdOut.AtEndOfStream)

        WScript.Echo(exec.StdOut.ReadAll());

 

    WScript.Quit(exec.ExitCode);

    }

 

// the real script code goes here ...

 

WScript.Echo("done");

 

In this sample we are just checking for AMD64, so you may want to add logic for Itanium or other platforms as well.

 

Be sure to notice the "ATTEMPT" comment when transposing the command line options from the current process into the new one. The way that the command shell handles double quotes makes it hard to reproduce the exact command line from the support we have in script. For example, if you pass /abc="hello world" as an argument, the quotes will get stripped out and you will actually see /abc=hello world from your script code. If we pass this raw argument (as shown above) into the new process then the one argument will be interpreted as two because of the missing quotes. It is left as a reader exercise to detect spaces and reconstruct the exact arguments if needed.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: gnuplot是一种流行的开源绘图工具,5.4.1是其最新版本,而Windows 64位则是指适用于Windows操作系统的64位版本。 gnuplot可以在Windows操作系统上运行,并且有专门针对64位系统的版本。通过下载并安装gnuplot 5.4.1的Windows 64位版本,您可以在64位的Windows系统上使用gnuplot进行数据可视化和绘图。 安装gnuplot的步骤相对简单。首先,您可以从gnuplot官方网站(https://gnuplot.info/)上下载适合于Windows 64位的安装程序。然后,运行该安装程序,并按照指导进行安装。 安装完成后,您可以通过启动gnuplot应用程序来使用它。gnuplot提供了一个命令行界面,您可以在其中输入绘图命令和参数。通过在命令行中输入相应的命令,您可以创建各种类型的图表,包括线图、散点图、柱状图等。您还可以设置图表的标题、坐标轴标签、图例等。 此外,gnuplot还支持导出图形为常见的图像文件格式,如PNG、JPEG和SVG。这使得您可以将绘制的图表保存为文件并在其他应用程序中使用。 总而言之,gnuplot 5.4.1的Windows 64位版本是一种强大的数据可视化工具,它可以帮助您在64位的Windows操作系统上绘制各种类型的图表,以便更好地理解和分析数据。 ### 回答2: gnuplot是一种强大的绘图工具,可以用于绘制各种类型的图表和图形。gnuplot 5.4.1是gnuplot的最新版本,适用于Windows 64位操作系统。 首先,为了使用gnuplot 5.4.1,您需要在gnuplot官方网站上下载适用于Windows 64位操作系统的安装包。安装包通常是一个可执行文件,您只需要双击它并按照安装向导的指示进行安装。 安装完成后,您可以通过启动gnuplot的可执行文件来打开gnuplot的命令行界面。在命令行界面中,您可以输入各种gnuplot命令来绘制图表和图形。 例如,您可以使用"plot"命令绘制二维图表。您只需要输入要绘制的数据和相关的选项即可开始绘图。另外,您还可以使用不同的颜色、线条风格和点风格来自定义图表的外观。 与此同时,gnuplot还支持绘制三维图表和图形。您可以使用"set view"命令设置视图角度,并使用"plot"命令绘制三维数据。您还可以使用其他命令来设置图表的外观,例如设置轴标签、图例和标题。 除了绘制图表,gnuplot还支持导出图形文件。您可以使用"set terminal"命令设置输出文件的格式(例如PNG或PDF),然后使用"set output"命令指定输出文件的名称。最后,使用"replot"命令来重新绘制图表并将其保存到输出文件中。 总体而言,gnuplot 5.4.1是一款功能强大的绘图工具,适用于Windows 64位操作系统。它提供了丰富的绘图和自定义选项,使用户能够轻松地创建各种类型的图表和图形。无论您是初学者还是专业人士,gnuplot都是一个值得尝试的工具。 ### 回答3: gnuplot是一个流行的开源数据可视化工具,用于生成高质量的科学图表。gnuplot 5.4.1是gnuplot软件的一个版本,适用于Windows 64位操作系统。 使用gnuplot 5.4.1可以绘制各种类型的图表,包括线图、散点图、柱状图、饼图、等值线图和3D图等。它支持多种数据文件格式,例如文本文件、CSV文件和二进制文件。用户可以通过简单的命令和脚本语言创建和定制图表。 gnuplot 5.4.1提供了丰富的图表定制选项,包括图表标题、坐标轴标签、图例、颜色、线型和点型等。用户可以调整图表的大小、比例和分辨率,以适应不同的需求。此外,gnuplot还支持数学函数的绘制,可以用于生成复杂的曲线和曲面。 为了在Windows 64位操作系统上安装gnuplot 5.4.1,可以按照以下步骤进行操作: 1. 访问gnuplot官方网站(https://www.gnuplot.info/)并下载适用于Windows 64位的安装程序。 2. 运行下载的安装程序,并按照提示进行安装。可以选择自定义安装选项,以便根据需要选择所需的组件和功能。 3. 完成安装后,可以在开始菜单或桌面上找到gnuplot的快捷方式。单击它打开gnuplot交互式终端。 4. 在gnuplot终端中,可以输入各种绘图命令和参数,以生成所需的图表。可以使用帮助命令来了解gnuplot的各种功能和用法。 总之,gnuplot 5.4.1是一个功能强大且易于使用的数据可视化工具,特别适用于科学研究和数据分析领域。通过安装并使用gnuplot 5.4.1,用户可以轻松地创建各种图表,以便更好地理解和展示数据。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值