如何将 Scripting.FileSystemObject 标记为安全的脚本? [英] How mark Scripting.FileSystemObject as safe for scripting?

查看:40
本文介绍了如何将 Scripting.FileSystemObject 标记为安全的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简介:

我正在为 CNC 机床编程.准确地说是比雅斯的流浪者.用于编程的软件编辑器支持 VBScript.VBScript 用于实现条件语句和循环等.在软件说明中,我列出了 VBScript 中的所有语法,标记为不用于避免复杂化:)

当然我想使用 VBScript :) 准确地说 - 打开 txt 文件并根据内容设置程序.

主要问题:VBScript 的所有语法都是有效的,例如:

Dim dicSet dic = CreateInstance("Scripting.Dictionary")

编译,但是:

昏暗的 fsoSet fso = CreateInstance("Scripting.FileSystemObject")

抛出错误/异常:

<块引用>

ActiveX 组件无法创建对象:'Scripting.FileSystemObject'

我尝试并检查了许多连接到未注册 dll 等的解决方案.一切似乎都有效并且没问题.我还检查了一个简单的脚本 .wsf

<工作><脚本语言="VBScript">set fso = CreateObject("Scripting.FileSystemObject")set fout = fso.CreateTextFile("c:\BiesseMacros\RemoteTest.txt", true)fout.WriteLine 现在关闭</工作></包>

它可以编译并运行.在 4-5 台不同的 PC 上情况相同.

这一切似乎都与不接受未标记为脚本和初始化安全的组件的软件有关?是否可以?我认为这是在应用程序项目中设置的内容.应用程序位于无法连接到 Internet 的计算机上,可在 Windows XP 上运行.我知道将此组件标记为安全是一个坏主意,但我真的很想这样做.它将为我节省几个月的工作(和生活;).

问题:

是否可以以及如何将 Scripting.FileSystemObject 标记为安全脚本?

解决方案

这个

瞧!

软件将此对象识别为安全.

请提供建议!

它可能对您的系统有害 - 因为它不应被标记为安全.通过这种方式,某些页面可以在没有通知的情况下使用该对象来操作您的文件!它对我有用 - 因为 PC 没有互联网连接,这是欺骗 3rd 方软件使用此对象的唯一方法!

Introduction:

I'm programing a CNC machine. To be exact a Rover from Biesse. The editor from the software that is used to programing support VBScript. VBScript is used for implementing conditional statments and loops etc. In instruction to the software i have listed all syntax from VBScript marked as not to be used to avoid complication :)

Of course I would like to use VBScript :) To be exact - to open txt file and set up program base on the content.

The main problem: All the syntax of the VBScript is valid e.g.:

Dim dic
Set dic = CreateInstance("Scripting.Dictionary")

compiles, but:

Dim fso
Set fso = CreateInstance("Scripting.FileSystemObject")

throws error/exepction:

ActiveX component can't create object: 'Scripting.FileSystemObject'

I tried and checked many solution connected to unregistered dlls etc. All seems valid and be ok. Also i checked a simple script .wsf

<package>
<job>
<script language="VBScript">
set fso = CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile("c:\BiesseMacros\RemoteTest.txt", true)
fout.WriteLine Now
fout.Close
</script>
</job>
</package>

It compiles and works. the situation is same on 4-5 different PC.

It all seems to be connected to the software not accepting components not marked as Safe for Scripting and Initialization ? Is it possible? I think it is something what is set up in project of application. App is on computer that won't connect to the internet, works on Windows XP. I know it is a bad idea to mark this component as safe, but i really want to. It will save me a couple of months of work (and life ;).

The question:

Is it possible and how to mark Scripting.FileSystemObject as Safe For Scripting?

解决方案

This link helped me out. In my case, I had to only create the key in registry

"Implemented Categories"

in HKCR\CLSID\"id's Scripting.FileSystemObject"

In this key i created same key as Scripting.Dictionary has:

and Voila!

Software recognize this object as safe.

Be advice!:

It can be harmful for your system - because it should not be marked as safe. In this way some pages could use the object without notification to manipulate your files! It is working for me - because the PC has no internet connection and that was the only way to trick the 3rd party software to use this object!

这篇关于如何将 Scripting.FileSystemObject 标记为安全的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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