piXelatedEmpire Posted July 24, 2005 Posted July 24, 2005 I am using cleanup.cmd to move and delete various shortcuts - from an edited script posted on these forums. Here is a snippet of my code: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 :: Make New Folders ::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 "%AUStart%\jv16 Powertools\jv16 PowerTools.lnk" "%AUStart%\Utilities\Windows System Tools"REM :: Move/Copy Shortcuts ::DEL /Y "%AUStart%\Adobe ImageReady CS.lnk"DEL /Y "%AUStart%\Adobe Help Center.lnk"DEL /Y "%AUStart%\Adobe Bridge.lnk"DEL /Y "%AUStart%\Stop StartupMonitor.lnk"MOVE /Y "%AUStart%\CCleaner\CCleaner.lnk" "%AUStart%\"MOVE /Y "%AUStart%\Crimson Editor\Crimson Editor.lnk" "%AUStart%\"MOVE /Y "%AUStart%\DVD Decrypter\DVD Decrypter.lnk" "%AUStart%\"MOVE /Y "%AUStart%\Elaborate Bytes\CloneDVD2\CloneDVD2.lnk" "%AUStart%\"MOVE /Y "%AUStart%\FlashGet\FlashGet.lnk" "%AUStart%\"MOVE /Y "%AUStart%\Kaspersky Anti-Virus Personal\Kaspersky Anti-Virus Personal.lnk" "%AUStart%\"My question is, what command would I use to rename specific shortcuts? For example:MOVE /Y "%AUStart%\Kaspersky Anti-Virus Personal\Kaspersky Anti-Virus Personal.lnk"what command would I use to rename that to Kaspersky.lnk? before anyone says anything, I attempted to search, using these search strings:+renaming +start +menu +shortcuts+renaming +startmenu +shortcuts+renaming +shortcuts+rename +startmenu +shortcuts+rename +shortcutsbut none of these searches returned anything useful...thanks for anyones assisstance
gunsmokingman Posted July 24, 2005 Posted July 24, 2005 (edited) Here try this code I have just shorten the names of the shortscuts This was done quickly, and I cannot test it. Green Color Text Can Be Removed From ScriptOrange Color Text Is Just A Popup I Used To Test The script Can be removed from scriptRed Color Text Are Error Popup Messages Can Be Removed From ScriptDim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim Act : Set Act = CreateObject("WScript.Shell")Dim AU_S : AU_S = Act.ExpandEnvironmentStrings("%AllUsersProfile%\Start Menu\Programs")Dim strComputer : strComputer = "."Dim F1'''' Array For LocationsDim Loc : Loc = Array((AU_S & "\Utilities"),(AU_S & "\Utilities\Administrative Tools"),_(AU_S & "\Utilities\Windows System Tools"),(AU_S & "\Accessories\System Tools"))'''' Array For ShortCut LocationsDim Ren : Ren = Array("%AUStart%\Kaspersky Anti-Virus Personal","%AUStart%\CCleaner","%AUStart%\Crimson Editor",_"%AUStart%\DVD Decrypter","%AUStart%\Elaborate Bytes\CloneDVD2","%AUStart%\FlashGet")Function MakeYourFoldersFor Each StrMD In LocIf Not Fso.FolderExist(StrMD) Then Fso.CreateFolder(StrMD) End IfNextEnd FunctionFunction AdmCopyF1 =(AU_S & "\Administrative Tools")If Fso.FolderExists(Loc(0)) Then Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='" & F1 & "'} Where " & "ResultClass = CIM_DataFile")For Each objFile In FileListName = objFile.NameAct.Popup "The File Path And Name" & vbCrLf & Name,7,"Test 001", 0 + 64 Fso.CopyFile(F1),(Loc(2))NextElseAct.Popup "Error In The Copy File" & vbCrLf & F1 & vbCrLf & "To Here" & vbCrLf & Loc(2), 10, 0 + 64End IfEnd FunctionFunction SysToolsSet objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='" & Loc(3) & "'} Where " & "ResultClass = CIM_DataFile")For Each objFile In FileList Name = objFile.Name Act.Popup "The File Path And Name" & vbCrLf & Name & Vbcrlf & "Test Location 2 " & vbCrLf & Loc(2),7,"Test 002", 0 + 64 Fso.MoveFile(Name),(Loc(2)) Next End FunctionFunction Jv16Dim F1 : F1 =(AU_S & "\jv16 Powertools\jv16 PowerTools.lnk")If Fso.FileExists(F1) Then Fso.MoveFile(F1),(Loc(2))ElseAct.Popup "Error In The Copy File" & vbCrLf & F1 & vbCrLf & "To Here" & vbCrLf & Loc(2), 10, 0 + 64End IfEnd FunctionFunction DelShortCutsDim Garbage : Garbage = Array(AU_S & "\Adobe ImageReady CS.lnk",AU_S & "\Adobe Help Center.lnk",AU_S & "%AUStart%\Adobe Bridge.lnk",AU_S & "%AUStart%\Stop StartupMonitor.lnk")For Each StrD In GarbageIf Fso.FileExists(StrD) Then Fso.DeleteFile(StrD) End IfNextEnd FunctionFunction ShortCutRenameIf Fso.FolderExists(Ren(0)) Then Fso.MoveFile(Ren(0) & "\Kaspersky Anti-Virus Personal.lnk"),(AU_S & "\K_AV_P.lnk") End If If Fso.FolderExists(Ren(1)) Then Fso.MoveFile(Ren(1) & "\CCleaner.lnk"),(AU_S & "\CC.lnk")End If If Fso.FolderExists(Ren(2)) Then Fso.MoveFile(Ren(2) & "\Crimson Editor.lnk"),(AU_S & "\CEditor.lnk")End If If Fso.FolderExists(Ren(3)) Then Fso.MoveFile(Ren(3) & "\DVD Decrypter.lnk"),(AU_S & "\DVD.lnk")End IfIf Fso.FolderExists(Ren(4)) Then Fso.MoveFile(Ren(4) & "\CloneDVD2.lnk"),(AU_S & "\CDVD2.lnk")End IfIf Fso.FolderExists(Ren(5)) Then Fso.MoveFile(Ren(5) & "\FlashGet.lnk"),(AU_S & "\FGet.lnk")End IfEnd Function'''' Start The FunctionsMakeYourFoldersAdmCopySysToolsJv16ShortCutRename Edited July 24, 2005 by gunsmokingman
piXelatedEmpire Posted July 24, 2005 Author Posted July 24, 2005 (edited) Interesting, I've never seen that kid of script (relatively new to unattended installs), thanks...what kind of script is this? I was kinda hoping there was some sort of command I could use with my existing cleanup.cmd... Edited July 24, 2005 by piXelatedEmpire
gunsmokingman Posted July 24, 2005 Posted July 24, 2005 It A Vbs Script, Saves the script as AllUserClean.vbsThen add this to your cleanup.cmdstart wscript.exe YOUR-PATH-TO-THE-SCRIPT\AllUserClean.vbs
Achdine Posted July 24, 2005 Posted July 24, 2005 This is probably a bit simpler MOVE /Y "%AUStart%\Kaspersky Anti-Virus Personal\Kaspersky Anti-Virus Personal.lnk" "%AUStart%\Kaspersky.lnk"
piXelatedEmpire Posted July 24, 2005 Author Posted July 24, 2005 thanks again gunsmokingman, but i wish to do this using my exisiting script.I suppose my question should be is there a RENAME command?for example: RENAME /Y "%AUStart%\Kaspersky Anti-Virus Personal.lnk" "%AUStart%\Kaspersky.lnk"would this work?
Achdine Posted July 24, 2005 Posted July 24, 2005 You missed my first post; I assume we were typing at the same time. But to answer your second question, yes, there is a rename command.C:\Documents and Settings\Achdine>rename /?Renames a file or files.RENAME [drive:][path]filename1 filename2.REN [drive:][path]filename1 filename2.Note that you cannot specify a new drive or path for your destination file.The easiest way to find out if a command exists is to type "<commandname> /?" at the command line, instead of posting a topic about it.
piXelatedEmpire Posted July 24, 2005 Author Posted July 24, 2005 This is probably a bit simpler MOVE /Y "%AUStart%\Kaspersky Anti-Virus Personal\Kaspersky Anti-Virus Personal.lnk" "%AUStart%\Kaspersky.lnk"Exactly what I wanted to know... thanks
piXelatedEmpire Posted July 24, 2005 Author Posted July 24, 2005 (edited) You missed my first post; I assume we were typing at the same time.Yeah I was.The easiest way to find out if a command exists is to type "<commandname> /?" at the command line, instead of posting a topic about it.well I did not know one could do this. My apologies.But thanks for your assistance all the same. Edited July 24, 2005 by piXelatedEmpire
Yzöwl Posted July 24, 2005 Posted July 24, 2005 REN (or RENAME) <drive:>\<path>\filename1 filename2You cannot however, specify a new drive or path for filename2.Therefore in your case, I would suggest you useMOVE <drive:>\<path>\filename1 <drive:>\<path>\filename2as already stated by AchdineNote also that in most of our systems the prompting for confirmation in batch files is suppressed therefore negating the requirement to use the /Y switch on the move, copy and delete commands.
piXelatedEmpire Posted July 24, 2005 Author Posted July 24, 2005 Note also that in most of our systems the prompting for confirmation in batch files is suppressed therefore negating the requirement to use the /Y switch on the move, copy and delete commands.thanks for the tip Yzowl
Cybertronic Posted July 25, 2005 Posted July 25, 2005 (edited) Is there such a command that hides the Startup folder on the Start Menu? Edited July 25, 2005 by Cybertronic
Dahi Posted July 25, 2005 Posted July 25, 2005 This will hide the Startup folder if you have "Do not show hidden iles and folders" selected in Explorer.attrib +H "%UserProfile%\Start Menu\Programs\Startup"
Cybertronic Posted July 25, 2005 Posted July 25, 2005 (edited) Thanks, it worked Edited July 26, 2005 by Cybertronic
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