So you're going to want to obtain the environment variable first and use
Set oWshShell = CreateObject("WScript.Shell")
Set oWshEnv = oWshShell.Environment("PROCESS")
sComputerName = oWshEnv("ComputerName")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFile = oFS.CreateTextfile("C:\temp\" & sComputerName & ".txt", true)
My syntax may be off here as I'm doing this from memory and haven't tested
but that's the basics of it. The CreateTextFile call will take the path
literally so you have to create the path using VB...
Hope this helps,
"Nick" <Nick@xxxxxx> wrote in message
> Hello all..
> I have the following two lines in my VBS file
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set TestFile = fs.CreateTextFile("c:\temp\file.txt", True)
> I want to be able to do something like this:
> set testfile = fs.createtextfile("c:\temp\%computername%.txt", true)
> However when I tried that it named the file %computername%.txt ..not
> what I wanted!
> Any suggestions on how I can achieve this?
> Learning as I go...thanks!