Hey Nick,
So you're going to want to obtain the environment variable first and use
that...
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,
Jon
www.insidetheregistry.com
--
"Nick" <Nick@xxxxxx> wrote in message
news:81632E09-71C3-425D-86F3-052505BC8B31@xxxxxx
> 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
> exactly
> what I wanted!
>
> Any suggestions on how I can achieve this?
>
> Learning as I go...thanks!