Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


renaming my computer icon

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> renaming my computer icon
  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 >>
 renaming my computer icon - 4/30/2008 8:41:03 AM   
  aschwartz

 

Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
Actually I have a script that does this:

Const MY_COMPUTER = &H11&

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
objFolderItem.Name = strComputer

The only problem is that I was just told that I need to change the script to rename the icon to the "computename - My Computer"

So I need to add the My Computer part at the end, but I am unsure of how to add that to this line.

objFolderItem.Name = strComputer

Any ideas?  I am quite new with VBS.  Thanks in advance.
 
 
Post #: 1
 
 RE: renaming my computer icon - 5/1/2008 12:30:22 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
objFolderItem.Name = strComputer & " - My Computer"

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aschwartz)
 
 
Post #: 2
 
 RE: renaming my computer icon - 5/1/2008 1:15:34 AM   
  aschwartz

 

Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
That worked perfectly.  Thank you very much.  I wasnt sure on the syntax. 

(in reply to ebgreen)
 
 
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 >> renaming my computer icon 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