使用Windows脚本运行时,尤其是其中的FileSystemObject是一个好主意吗? [英] Is using the windows scripting runtime, especially the FileSystemObject thereof a good idea?

查看:74
本文介绍了使用Windows脚本运行时,尤其是其中的FileSystemObject是一个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我被要求对VB6应用程序进行一些维护.这涉及一些文件IO.我发现通过引用Windows脚本主机并使用FileSystemObject提供的IO操作比VB6随附的IO操作友好得多.

但这是否会由于安全问题或由于脚本主机将在某些用户的计算机上被禁用而引起问题?

Recently I have been asked to do some maintenance on a VB6 application. This involves some file IO. I find the IO operations offered by referencing the windows script host and using the FileSystemObject a lot friendlier than the IO operations that come with VB6.

But will this cause problems because of security issues, or because of the fact that the script host will be disabled on some users' computers?

更新(2012年8月20日):自从提出此问题以来,我们遇到了3000名客户中有3次出现无法正常运行的scrrun.dll的问题.我们必须通过远程支持手动修复这些问题.似乎有时应该归咎于病毒扫描程序.

Update (aug 20, 2012): Since asking this question we have encountered the problem of a non functional scrrun.dll three times among 3000 customers. We had to fix these manually through remote support. It seems that sometimes a virusscanner is to blame.

推荐答案

正如罗伯特·哈维(Robert Harvey)在其评论中提到的那样,实际上这通常不是问题.但是scrrun.dll可能未安装或未在给定计算机上正确注册.在客户计算机上安装自己的VB6应用程序时,我们遇到了两种情况.

As Robert Harvey mentioned in his comment, this isn't usually a problem in practice. It's possible that the scrrun.dll may either not be installed or is not registered correctly on a given machine though. We've encountered both scenarios when installing our own VB6 application on customer's machines.

关于禁用脚本,我们实际上已经在其他应用程序(例如Microsoft InfoPath)中遇到了此问题,并通过调出InfoPath表单(需要执行一些文件I/O)来解决此问题.到使用WSH FileSystemObject的VB6 DLL,因此,如果有的话,您实际上可以通过将库与VB6结合使用来解决脚本安全问题.据我所知,WSH安全设置专门适用于实际脚本,而不适用于恰巧使用脚本运行时中的组件的程序.

As for scripting being disabled, we've actually run into this problem with other applications (such as Microsoft InfoPath), and got around the issue by having the InfoPath form (which needed to do some file I/O) call out to a VB6 DLL that used the WSH FileSystemObject, so if anything, you can actually work around script security problems by using the library in conjunction with VB6. As far as I know, WSH security settings apply specifically to actual scripts, not to programs that happen to use components from the scripting runtime.

实际上,您可以完全禁用计算机上的Windows Scipt主机,并且仍然可以从VB6应用程序访问WSH组件,例如FileSystemObject.

In fact, you can completely disable the Windows Scipt Host on your machine, and still access the WSH components, such as FileSystemObject, from a VB6 application.

这篇关于使用Windows脚本运行时,尤其是其中的FileSystemObject是一个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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