0

I need a VB script which will create text file named "listitem" in C:\Documents and Settings\All Users\Application Data\secon\smartapp up to C:\Documents and Settings\All Users\Application Data\ we can make it as 'CommonAppDataFolder'

Any one knows about this

peter
  • 8,158
  • 21
  • 66
  • 119

2 Answers2

1

OK, let's see if I can remember how to do this...

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
PhilPursglove
  • 12,511
  • 5
  • 46
  • 68
1

Here're some tips for you:

Hope you can manage the rest yourself. :)

Community
  • 1
  • 1
Helen
  • 87,344
  • 17
  • 243
  • 314