Vbscript 用Vb脚本创建文件
我需要一个VB脚本,它将在C:\Documents and Settings\All Users\Application Data\secon\smartapp中创建名为“listitem”的文本文件 最多C:\Documents and Settings\All Users\Application Data\我们可以将其设置为“CommonAppDataFolder”Vbscript 用Vb脚本创建文件,vbscript,Vbscript,我需要一个VB脚本,它将在C:\Documents and Settings\All Users\Application Data\secon\smartapp中创建名为“listitem”的文本文件 最多C:\Documents and Settings\All Users\Application Data\我们可以将其设置为“CommonAppDataFolder” 任何人都知道这个好吧,让我们看看我是否记得如何做这个 Dim fso 'As Scripting.FileSystemObje
任何人都知道这个好吧,让我们看看我是否记得如何做这个
Dim fso 'As Scripting.FileSystemObject
Dim stream 'As Scripting.TextStream
Set fso = CreateObject("Scripting.FileSystemObject")
'Check that the secon folder exists
If fso.FolderExists("C:\Documents and Settings\All Users\Application Data\secon") Then
Else
fso.CreateFolder("C:\Documents and Settings\All Users\Application Data\secon")
End If
'Check that the smartapp folder exists
If fso.FolderExists("C:\Documents and Settings\All Users\Application Data\secon\smartapp") Then
Else
fso.CreateFolder("C:\Documents and Settings\All Users\Application Data\secon\smartapp")
End If
'Create the file as ASCII text, overwrite it if it already exists
Set stream = fso.CreateTextFile("C:\Documents and Settings\All Users\Application Data\secon\smartapp\listitem.txt", true, false)
'Close it neatly
stream.Close
'Clean up
Set stream = Nothing
Set fso = Nothing
以下是给你的一些提示:
- 要以编程方式获取CommonAppData路径,请使用方法。(35是根据的文件夹id。)有关示例,请参阅
- 要连接两条路径,请使用以下方法
- 要创建文本文件,可以使用以下方法
希望你能自己处理剩下的事。:) 我需要一个使用CommonAppData的优化解决方案此wl工作正常,但我需要一个使用CommonAppData的优化解决方案