/build/static/layout/Breadcrumb_cap_w.png

VBScript Shortcut Manipulation

I've been using this website to learn about deploying and it's been great to me. I put together a list of VBScript commands that I use to move or delete shortcuts after I install programs. It works great with WIWW by adding the script after the silent install.



' This is needed for all file manipulation
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")

' This is needed for accessing special folders
Set WshShell = WScript.CreateObject("WScript.Shell")


----------------
Creating Folders
----------------

dim newfolder

If Not filesys.FolderExists(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Internet\") Then

Set newfolder = filesys.CreateFolder(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Internet\")

End If



----------------
Deleting Folders
----------------

If filesys.FolderExists(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Alcohol") Then

filesys.DeleteFolder(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Alcohol")

End If


--------------
Deleting Files
--------------

If filesys.FileExists("c:\somefile.txt") Then

filesys.DeleteFile("c:\somefile.txt")

End If


------------
Moving Files
------------

If filesys.FileExists("c:\sourcefolder\anyfile.html") Then

filesys.MoveFile("c:\sourcefolder\anyfile.html", "c:\destfolder\")

End If


--------------
Moving Folders
--------------

dim mfolder

If Not filesys.FolderExists(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Entertainment") Then

set mfolder = filesys.GetFolder(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Accessories\Entertainment")

mfolder.Move (wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Entertainment")

End If



------------------


Special folders to be used as: wshShell.SpecialFolders("AllUsersStartMenu")

The & character is used to join strings

* AllUsersDesktop
* AllUsersStartMenu
* AllUsersPrograms
* AllUsersStartup
* Desktop
* Favorites
* Fonts
* MyDocuments
* NetHood
* PrintHood
* Programs
* Recent
* SendTo
* StartMenu
* Startup
* Templates

More special folders:
http://www.activexperts.com/activmonitor/windowsmanagement/scripts/desktop/specialfolders/



--------------------
Program files folder
--------------------


' Define object for the "Program Files" folder
Const PROGRAM_FILES = &H26&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(PROGRAM_FILES)
Set objProgramFiles = objFolder.Self
' program files is referenced by: objProgramFiles.Path



---------------
Using with WIWW
---------------

After the silent install

wscript.exe scriptname.vbs //B

//B suppresses errors

0 Comments   [ + ] Show comments

Answers (3)

Posted by: bbrian 16 years ago
Yellow Belt
0
I want to delete all the Adobe Reader shortcuts that are created.
In the Shortcut table in Orca, what do I change? Do I just delete each entry or do I edit ShowCmd?
Posted by: anonymous_9363 16 years ago
Red Belt
0
Just delete the table.
Posted by: jmcfadyen 16 years ago
5th Degree Black Belt
0
condition the createshortcuts action with something that will never happen.

I use 1=2 this means that it will not be processed. the benefit to this method is that later you can enable them without having to repackage the app.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ