homie742 Posted March 3, 2005 Posted March 3, 2005 Hi all,I'm not sure if this is the right place for this question, if not please move it.What I want to do is create a batch or cmd file to move a shortcut from the desktop to quick launch. This will be part of my clean up since I like to move shortcuts around. Also, is there a way to delete unwanted shortcuts from the desktop or quick lanch?Thanks
gunsmokingman Posted March 3, 2005 Posted March 3, 2005 (edited) Here Is A SFX Vbs File That Will Do What You Want. Dim Shell, AP, UP, SD, SP, Wd, fso, fV = Vbcrlfon error resume nextSet Shell = WScript.CreateObject("WScript.Shell")AP = Shell.ExpandEnvironmentStrings("%AllUsersProfile%")UP = Shell.ExpandEnvironmentStrings("%UserProfile%")SD = Shell.ExpandEnvironmentStrings("%SystemDrive%")SP = Shell.ExpandEnvironmentStrings("%SystemDrive%\Program Files")WD = Shell.ExpandEnvironmentStrings("%Windir%\") Set fso = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFSO = CreateObject("Scripting.FileSystemObject") Set fso = CreateObject("Scripting.FileSystemObject") set objShell = CreateObject("Shell.Application") set objFolder = objShell.NameSpace(AP & "\Application Data\Microsoft\Internet Explorer\Quick Launch") Wscript.sleep 300 if not objFolder is nothing then objFolder.CopyHere(AP & "\Desktop\*.lnk") end if set objShell = nothing set objFolder = nothing Wscript.sleep 300 On Error Resume Next Set objFSO = CreateObject("Scripting.FileSystemObject") Set fso = CreateObject("Scripting.FileSystemObject") set objShell = CreateObject("Shell.Application") set objFolder = objShell.NameSpace(UP & "\Application Data\Microsoft\Internet Explorer\Quick Launch") Wscript.sleep 300 if not objFolder is nothing then objFolder.CopyHere(UP & "\Desktop\*.lnk") end if set objShell = nothing set objFolder = nothing Wscript.sleep 300''''''''HERE WHERE WE WILL PERFORM ALL THE CLEAN UPS ON ERROR RESUME NEXTfso.DeleteFile( AP & "\Desktop\*.lnk")fso.DeleteFile( UP & "\Desktop\*.lnk")fso.DeleteFile( AP & "\Start Menu\Set Program Access and Defaults.lnk")fso.DeleteFile( AP & "\Start Menu\Windows Catalog.lnk")fso.DeleteFolder( SD & "\Drivers")fso.DeleteFolder( SD & "\Install")shell.popup "Completed Clean Up preparing To Shut Down",5,"Gsm Clean Up",0+32sh.Run ("shutdown.exe -r -f -t 60 -m ""Windows XP will now restart in 1 minute...""")fso.DeleteFile( SD & "\GsmClean.vbs") Edited January 5, 2006 by gunsmokingman
durex Posted March 5, 2005 Posted March 5, 2005 or a simple batch file if you so desire... (Copy and paste the following text into notepad and save it as "<filename>.cmd")This will move all shortcuts from All Users and User Profile desktop to the quick launch.set UserQL=%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launchset AUDesk=%AllUsersProfile%\Desktopset UserDesk=%UserProfile%\DesktopMOVE /Y "%AUDesk%\*.lnk" "%UserQL%"MOVE /Y "%UserDesk%\*.lnk" "%UserQL%"Or if you want to move specific shortcuts from your Desktop to Quick Launch you can use the following (just edit with the shortcuts you want to move of course):set UserQL=%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launchset AUDesk=%AllUsersProfile%\Desktopset UserDesk=%UserProfile%\DesktopMOVE /Y "%AUDesk%\<Name of Shortcut1>.lnk" "%UserQL%"MOVE /Y "%AUDesk%\<Name of Shortcut2>.lnk" "%UserQL%"MOVE /Y "%AUDesk%\<Name of Shortcut3>.lnk" "%UserQL%"And finally if you want to delete shortcuts from your Desktop you simply add the following to your batch file:DEL /Q /F %AUDesk%\<Name of Shortcut1.lnk"DEL /Q /F %AUDesk%\<Name of Shortcut2>.lnk"Typically this stuff is placed in your 'cleanup.cmd' and is one of the last things you run from RunOnceEx or GuiRunOnce...Heres what my cleanup.cmd looks like. As you can see in addition to moving and deleting shortcuts from my desktop, I also move, copy and delete shorcuts and folders to and from my start menu, quick launch and desktop. Hope this helps!@echo offcmdow @ /HIDfor %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\WIN51 set CDROM=%%a:set AUStart=%AllUsersProfile%\Start Menu\Programsset UserStart=%UserProfile%\Start Menu\Programsset UserQL=%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launchset AUDesk=%AllUsersProfile%\Desktopset UserDesk=%UserProfile%\DesktopREM ::::::::::::::::::::REM :::: User Admin ::::REM ::::::::::::::::::::REM :: Remove ASP User ::net user aspnet /deleteREM ::::::::::::::::::::REM :::: Start Menu ::::REM ::::::::::::::::::::REM :: Make New Folders ::MD "%AUStart%\Entertainment"MD "%AUStart%\Internet"MD "%AUStart%\Multimedia"MD "%AUStart%\Utilities"MD "%AUStart%\Utilities\Administrative Tools"MD "%AUStart%\Utilities\Windows System Tools"REM :: Move / Copy Folders ::COPY /Y "%AUStart%\Administrative Tools" "%AUStart%\Utilities\Administrative Tools"MOVE /Y "%AUStart%\Accessories\System Tools\*" "%AUStart%\Utilities\Windows System Tools"MOVE /Y "%UserStart%\Multimedia" "%AUStart%"REM :: Move / Copy Shortcuts ::MOVE /Y "%AUStart%\Adobe Photoshop CS.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\Adobe ImageReady CS.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\Executive Software Diskeeper.lnk" "%AUStart%\Utilities"MOVE /Y "%AUStart%\Adobe Reader 7.0.lnk" "%AUStart%\Accessories"MOVE /Y "%AUStart%\Accessories\Communications\Remote Desktop Connection.lnk" "%AUStart%\Internet"MOVE /Y "%AUStart%\Accessories\Communications\Wireless Network Setup Wizard.lnk" "%AUStart%\Utilities\Windows System Tools"MOVE /Y "%AUStart%\Accessories\Entertainment\Sound Recorder.lnk" "%AUStart%\Accessories"MOVE /Y "%AUStart%\Accessories\Entertainment\Volume Control.lnk" "%AUStart%\Utilities"MOVE /Y "%AUStart%\AccountLogon\AccountLogon.lnk" "%AUStart%\Accessories"MOVE /Y "%AUStart%\eMule\eMule Plus.lnk" "%AUStart%\Internet"MOVE /Y "%AUStart%\Games" "%AUStart%\Entertainment"MOVE /Y "%AUStart%\GlobalSCAPE\CuteFTP Professional\CuteFTP Professional.lnk" "%AUStart%\Internet"MOVE /Y "%AUStart%\Grabit\GrabIt.lnk" "%AUStart%\Internet"MOVE /Y "%AUStart%\iTunes\iTunes.lnk" "%AUStart%\Multimedia" MOVE /Y "%AUStart%\Mozilla Firefox\Mozilla Firefox.lnk" "%AUStart%\Internet"MOVE /Y "%AUStart%\Nero\Nero 6 Ultra Edition\Nero Burning ROM.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\Norton AntiVirus\Norton AntiVirus 2005.lnk" "%AUStart%\Utilities"MOVE /Y "%AUStart%\QuickTime Alternative\QuickTime Settings.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\Real Alternative\RealMedia Settings.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\Tag&Rename\Tag&Rename.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUStart%\WinRAR\WinRAR.lnk" "%AUStart%\Utilities"MOVE /Y "%AUDesk%\Adobe Reader 6.0.lnk" "%AUStart%\Multimedia"MOVE /Y "%AUDesk%\Norton Antivirus 2005.lnk" "%AUStart%\Utilities"MOVE /Y "%UserStart%\QuickPar.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Remote Assistance.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Windows Media Player.lnk" "%AUStart%\Multimedia"MOVE /Y "%UserStart%\Accessories\Address Book.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Accessories\Command Prompt.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Accessories\Windows Explorer.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Accessories\Entertainment\Windows Media Player.lnk" "%AUStart%\Multimedia"MOVE /Y "%UserStart%\Powertoys for Windows XP\Slide Show Wizard.lnk" "%AUStart%\Accessories"MOVE /Y "%UserStart%\Powertoys for Windows XP\TweakUI for Windows XP.lnk" "%AUStart%\Utilities"MOVE /Y "%UserStart%\Winamp\Winamp.lnk" "%AUStart%\Multimedia"MOVE /Y "%UserStart%\Startup\*" "%AUStart%\Startup"REM :: Remove Folders ::RD /S /Q "%AUStart%\Accessories\Accessibility"RD /S /Q "%AUStart%\Accessories\Communications"RD /S /Q "%AUStart%\Accessories\Entertainment"RD /S /Q "%AUStart%\Accessories\System Tools"RD /S /Q "%AUStart%\AccountLogon"RD /S /Q "%AUStart%\eMule"RD /S /Q "%AUStart%\GlobalSCAPE"RD /S /Q "%AUStart%\GrabIt"RD /S /Q "%AUStart%\iTunes"RD /S /Q "%AUStart%\Java Web Start"RD /S /Q "%AUStart%\Mozilla Firefox"RD /S /Q "%AUStart%\Nero"RD /S /Q "%AUStart%\Norton AntiVirus"RD /S /Q "%AUStart%\PrintMe Internet Printing"RD /S /Q "%AUStart%\QuickTime Alternative"RD /S /Q "%AUStart%\Real Alternative"RD /S /Q "%AUStart%\Tag&Rename"RD /S /Q "%AUStart%\WinRAR"RD /S /Q "%UserStart%\Accessories\Entertainment"RD /S /Q "%UserStart%\Powertoys for Windows XP"RD /S /Q "%UserStart%\Winamp"RD /S /Q "%UserStart%\WinRAR"RD /S /Q "C:\Documents and Settings\All Users\Documents"RD /S /Q "C:\Documents and Settings\durex\My Documents"RD /S /Q "C:\Documents and Settings\durex\Favorites"RD /S /Q "D:\!Personal!\My Documents\My Music"REM :: Remove Shortcuts ::DEL /Q /F "%AllUsersProfile%\Start Menu\Activate Windows.lnk"DEL /Q /F "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk"DEL /Q /F "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"DEL /Q /F "%AUStart%\Startup\Adobe Gamma Loader.lnk"DEL /Q /F "%AUStart%\Startup\Adobe Reader Speed Launch.lnk"DEL /Q /F "%UserStart%\Uninstall.lnk"DEL /Q /F "%UserStart%\Website.lnk"DEL /Q /F "%UserStart%\Accessories\Program Compatibility Wizard.lnk"DEL /Q /F "%UserQL%\Launch Internet Explorer Browser.lnk"DEL /Q /F "%UserQL%\Nero StartSmart.lnk"DEL /Q /F "%UserQL%\Tag&Rename.lnk"DEL /Q /F "%UserQL%\Windows Media Player.lnk"DEL /Q /F "%AUDesk%\*.*"DEL /Q /F "%UserDesk%\*.*"REM ::::::::::::::::::::::REM :::: Quick Launch ::::REM ::::::::::::::::::::::REM :: Create New Folders ::MD "%UserQL%\New Folder"REM MD "%UserQL%\Recycle Bin.{645FF040-5081-101B-9F08-00AA002F954E}"REM :: Create / Copy New Shortcuts ::COPY /Y "%AUStart%\Accessories\AccountLogon.lnk" "%UserQL%"COPY /Y "%AUStart%\Accessories\Windows Explorer.lnk" "%UserQL%"COPY /Y "%AUStart%\Internet\CuteFTP Professional.lnk" "%UserQL%"COPY /Y "%AUStart%\Internet\eMule Plus.lnk" "%UserQL%"COPY /Y "%AUStart%\Internet\GrabIt.lnk" "%UserQL%"REM COPY /Y "%AUStart%\Microsoft Office\Microsoft Office Outlook 2003.lnk" "%UserQL%"COPY /Y "%AUStart%\Multimedia\iTunes.lnk" "%UserQL%"COPY /Y "%AUStart%\Multimedia\Winamp.lnk" "%UserQL%"COPY /Y "%AUStart%\Multimedia\Media Player Classic.lnk" "%UserQL%"COPY /Y "%AUStart%\Multimedia\Nero Burning ROM.lnk" "%UserQL%"COPY /Y "%UserStart%\Entertainment\Steam.lnk" "%UserQL%"COPY /Y "%UserStart%\Internet\Trillian.lnk" "%UserQL%"COPY /Y "%CDROM%\Custom\Misc\Recycle Bin.lnk" "%UserQL%"REM ::::::::::::::::::::::::::::REM :::: Misc File Cleanup :::::REM ::::::::::::::::::::::::::::REM :: Remove Folders ::RD /S /Q "%ProgramFiles%\Adobe"RD /S /Q "%systemdrive%\drivers"REM :: Remove Logs & System Files ::DEL /Q "%systemsdrive%\iTunes.log"DEL /Q "%systemsdrive%\ps.log"DEL /Q "%systemroot%\*.bmp"DEL /Q "%systemroot%\Web\Wallpaper\*.jpg"REM DEL /Q "%systemroot%\system32\dllcache\*.scr"REM DEL /Q "%systemroot%\system32\*.scr"REM :: Disable Start Menu Admin Tools ::REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v StartMenuAdminTools /t REG_DWORD /d 0 /fREM :: Unregister 'Who Lock Me' until RyanVM fixes Explore Start menu ::REM regsvr32 /u /s WhoLockMe.dllEXIT
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now