Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Use variable as file name

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62215
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Use variable as file name
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Use variable as file name - 7/8/2008 2:26:43 AM   
  shermerthug

 

Posts: 2
Score: 0
Joined: 7/8/2008
Status: offline
I would like to know how to use a variable as the output file name for my script.  Basically what I'm looking for is to run the script on each pc and have CSName.txt (where CSName is the individual pc name) as the file name.  This is what I have that copies my log file to the proper directory, but I can't the the name correct. 

oFSO.CopyFile LogFile,"\\ohmen100\dist\Inventory\CSName.txt"

Regards,

Jason
 
 
Post #: 1
 
 RE: Use variable as file name - 7/8/2008 2:52:30 AM   
  ginolard


Posts: 1053
Score: 21
Joined: 8/10/2005
Status: offline
Like this

Set objnet = CreateObject ("Wscript.network")
oFSO.CopyFile LogFile,"\\ohmen100\dist\Inventory\" & objNet.ComputerName & ".txt"

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to shermerthug)
 
 
Post #: 2
 
 RE: Use variable as file name - 7/8/2008 4:30:33 AM   
  shermerthug

 

Posts: 2
Score: 0
Joined: 7/8/2008
Status: offline
many thanks.

(in reply to ginolard)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Use variable as file name Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts