问题标签 [filesystemobject]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
537 浏览

activex - ActiveX Control always working on my machine - unpredictable behavior on others?

I have a question about my ActiveX control not always working in IE on other machines.

Context: I'm working on an internal app for my company. It is designed to be a standalone web-page config tool for viewing a static customized version of our web app. The user may select the colors, images, and other settings they would like to see, and these will be present in the static mockup/preview version on their machine when they click a button.

Implementation: my javascript file creates a filesystem/activex object that essentially creates a temporary javascript file to which a list of values are written. Then when the user previews the configuration, the javascript file is located and values are loaded dynamically into the dom, etc etc. Naturally this functionality only works in Internet Explorer and is shady at best, but is my only way of implementing a purely zero configuration, client-side dynamic webapp.

Problem: When I test out my script, Internet Explorer prompts me twice about ActiveX controls and I say "yes" to them and the ActiveX functions work. I do this every single time I open my page. But sometimes when I send the file to another person so they can use it, they don't get the notifications so it doesn't work. However sometimes they do get notifications and it does work! I am using default security settings for IE so there should be no difference between my settings and theirs.

Could this be related to my user permissions vs theirs, or the fact that the files are read-only (because they are coming from source control and are also being made read-only when put on the shared drive.) or unknown dark Microsoft forces beyond human comprehension?

Thanks, Josh

0 投票
2 回答
1423 浏览

javascript - 如何使用 javascript 和 ActiveX 打开、修改和保存文件?

我尝试了不同的方法在客户端打开和显示文件,而不将文件发送到服务器。

打开:我尝试使用 javascript 从 a 访问文件<input type=file>,但安全限制似乎不允许这样做。我也尝试过<iframe src=file://local.path>同样的问题。最后我尝试了new ActiveXObject('Scripting.FileSystemObject');,但我总是收到一个错误,即自动化服务器无法创建对象。

为了保存,我尝试使用execCommand('SaveAs',true)TextRange 和 DocumentFragment。从 DocumentFragment 我可以保存一个文件,但它只包含<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">. 从 TextRange 没有显示保存对话框。

我能做什么?

0 投票
1 回答
318 浏览

performance - Scripting.FileSystemObject 与 Server.Execute

哪个更快?(对于静态 html 页面包括)

0 投票
1 回答
561 浏览

scripting - FileSystemObject 的驱动器号使用 - VBScript

我正在从 Win 2003 服务器迁移到 Win 2008 R2 服务器。我正在运行一个经典的 ASP 应用程序。在 2003 服务器中,以下代码用于创建文件:

    CONST SCRATCH_DIR = "E:\Temp\"
    设置 FSO = CreateObject("Scripting.FileSystemObject")
    设置 TFL = FSO.CreateTextFile(SCRATCH_DIR & "Debug.txt", True)

在新服务器上,Set TFL 行给了我这个错误:

    Microsoft VBScript 运行时错误“800a0046”
    权限被拒绝
    /inc/vbutil.inc,第 110 行

如果我从 CONST 中删除驱动器名称“E:\”,程序就可以正常工作;(除了它写入 C:\ 驱动器)所以我确定错误消息是正确的。

谁能指出我将在哪里/如何更改此 (E:\Temp) 目录的权限?

首先十分感谢,

(一个愚蠢的应用程序程序员;)

0 投票
2 回答
1526 浏览

filesystemobject - FileSystemObject:GetFolder 和 GetParentFolderName 有什么区别?

在 FileSystemObject 中,GetFolder 和 GetParentFolderName 有什么区别?

0 投票
1 回答
2025 浏览

windows - 为什么此 VBScript 在尝试创建文件时会引发错误?

我找到了这个脚本,但似乎无法弄清楚为什么它在尝试创建文件时会引发错误C:\IPSecWeights.xls

到目前为止,我遇到的问题是:

我收到找不到文件的错误。我怎样才能重写我的代码来解决这个问题?

0 投票
3 回答
39080 浏览

vbscript - 错误:ActiveX 组件无法创建对象 Scripting.FileSystemObject

我的驱动器 c: 上有一个简单的 vbs 文件,内容如下:

当我尝试启动它时,出现错误

c:\fso.vbs(1, 1) Microsoft VBScript 运行时错误:ActiveX 组件无法创建对象:'Scripting.FileSystemObject'

我尝试以管理员身份登录并执行wscript -regserver,但没有帮助。

有人能帮助我吗?

0 投票
1 回答
1798 浏览

windows - 如何使用 FileSystemObject.Size 可靠地确定文件夹大小?

试图计算可能非常大的文件夹的大小,我使用了FileSystemObject.Size

在某些情况下,folder_size正常返回,但在其他情况下,调用会Size引发异常。计算文件夹的C:\大小

我得到以下输出:

这似乎至少部分是权限问题,因为以管理员身份运行代码会更改一些输出(以粗体表示)。

MUI 错误消息对应于ERROR_MUI_FILE_NOT_FOUND.

我的代码怎么不正确?

对于上下文,我不需要使用FileSystemObject. 我考虑的其他方法是刮取dir /s子树中所有叶子的输出并将其大小相加。对于大型目录, 的输出dir /s可能是巨大的,并且搜索整个子树是一种性能狗。Windows 资源管理器似乎总是能够在给定足够的时间的情况下计算结果,那么有没有办法调用它正在做的任何事情?

0 投票
2 回答
7681 浏览

javascript - 在 Javascript 中使用“FSO”,如何将变量的内容写入文件?

可能重复:
如何在 JavaScript 中将变量的内容写入文件

我有这段代码来创建一个文本文件。如何写入此文本文件?

0 投票
3 回答
1592 浏览

c# - C# FileSystemObject How to get folder's comment property?

If i create a folder in windows and right click select properties and give some comment about it in the comment field. in C#, How do i get the comment for a folder ? Is there any "Comment" Property available ?