• 0

[VBS] Refreshing the Desktop


Question

can someone give me a reference to a code that makes the desktop refresh?

'STUDENT FOLDER SHORTCUT SCRIPT - Written By: Derek Perez '04
'============================================================

'Set All Used API
'=======================================
set ws_obj = WScript.CreateObject("WScript.Shell")
set fso_obj = CreateObject("Scripting.FileSystemObject")
trgt_folder = ws_obj.SpecialFolders("Desktop")


'Checking for Folder Existance Procedure
'=======================================
Dim fso_obj
if (fso_obj.FolderExists(trgt_folder & "\Student Applications")) Then
else

'Creating Folder IF NOT FOUND
'=======================================
set stdnt_folder = fso_obj.CreateFolder(trgt_folder & "\Student Applications")

'=======================================
'=======================================
'Now Placing Word 2003 in "Student Applications" Folder.
'=======================================
Set Shortcut = ws_obj.CreateShortcut(trgt_folder & "\Student Applications" + "\\Word 2003.lnk")
Shortcut.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"
shortcut.save

end if

thats what i have. the Folder does not show up until you refresh the desktop and i can not figure out why :/

any ideas?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I'm not a expert on VBS but why don't you try this:

'STUDENT FOLDER SHORTCUT SCRIPT - Written By: Derek Perez '04
'============================================================

'Declare Variables
'=======================================
Dim ws_obj, fso_obj, trgt_folder, stdnt_folder, Shortcut

'Set All Used API
'=======================================
set ws_obj = WScript.CreateObject("WScript.Shell")
set fso_obj = CreateObject("Scripting.FileSystemObject")
trgt_folder = ws_obj.SpecialFolders("Desktop")


'Checking for Folder Existance Procedure
'=======================================
If Not (fso_obj.FolderExists(trgt_folder & "\Student Applications")) Then

'Creating Folder IF NOT FOUND
'=======================================
set stdnt_folder = fso_obj.CreateFolder(trgt_folder & "\Student Applications")

'=======================================
'=======================================
'Now Placing Word 2003 in "Student Applications" Folder.
'=======================================
Set Shortcut = ws_obj.CreateShortcut(trgt_folder & "\Student Applications" + "\\Word 2003.lnk")
Shortcut.TargetPath = "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"
shortcut.save

End If

Hope it helps ;)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.