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

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

2 Comments

i need an optimized solution by using CommonAppData
this wl work fine,but i need an optimized solution by using CommonAppData
1

Here're some tips for you:

Hope you can manage the rest yourself. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.