I'm looking to display the %ComputerName% in a new toolbar, NOT the Taskbar from a VBScript for win10

John Franklin 66 Reputation points

I'm looking to display the %ComputerName% in a new toolbar, NOT the Taskbar from a VBScript
This is what I've done so far..

Set FSO = CreateObject("Scripting.FileSystemObject")
Set wshShell = CreateObject( "WScript.Shell" )
strtemplocation = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
' Write To A File
Set File = FSO.CreateTextFile(strtemplocation & "\computername.reg",True)
File.Write "Windows Registry Editor Version 5.00 " & Chr(13)+Chr(10)
File.Write " "& Chr(13)+Chr(10)
File.Write "[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}]" & Chr(13)+Chr(10)
File.Write "@=" & chr(34)+strComputerName & chr(34)+Chr(13)+Chr(10)
File.Write Chr(13)+Chr(10)
File.Write "[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon] " & Chr(13)+Chr(10)
file.Write"@=" & "C:\Windows\System32\imageres.dll,-109" & Chr(13)+Chr(10)
File.Write Chr(13)+Chr(10)
Set objShell = CreateObject("Wscript.Shell")
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile)
strPath = "regedit /s "&strtemplocation & "\computername.reg"
objShell.Run strPath

Dim WshShell
Dim strDesktopPath, strAllUsers, strCurrentUser, QuickLaunch, strIconPath
strDesktopPath = WshShell.ExpandEnvironmentStrings("%UserProfile%") & "\Desktop\"
strAllUsers = WshShell.ExpandEnvironmentStrings("%UserProfile%")
strURL = ""
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath&strcomputername&".lnk")
objShortcutUrl.TargetPath = strURL
objShortcutUrl.IconLocation = strIconPath
'Create a Start menu option
strstartlocation = wshShell.ExpandEnvironmentStrings("%AppData%"&"\microsoft\windows\start menu\programs\System Tools\")
Set objShortcutUrl = WshShell.CreateShortcut(strstartlocation&strcomputername&".lnk")
objShortcutUrl.TargetPath = strURL
objShortcutUrl.IconLocation = strIconPath

'Create New Toobar

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
9,534 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Carl Fan 6,821 Reputation points

    According to your description, you want to right-click on Taskbar -> Go to Toolbars -> Choose New Toolbar, type in \%computername%, and Click Select Folder. Done.
    But if you want to use VBS to add new Items in Toolbar, to help you better, I suggest you post the issue on MSDN forum as they will be more professional on your code issue:
    Hope this helps and please help to accept as Answer if the response is useful.
    Best Regards,

    0 comments No comments