Jump to content

Recommended Posts

Posted

:hello:

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\Programs
set UserStart=%UserProfile%\Start Menu\Programs
set UserQL=%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch
set AUDesk=%AllUsersProfile%\Desktop
set UserDesk=%UserProfile%\Desktop

REM :: 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 +shortcuts

but none of these searches returned anything useful...

thanks for anyones assisstance :yes:


Posted (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 Script

Orange Color Text Is Just A Popup I Used To Test The script Can be removed from script

Red Color Text Are Error Popup Messages Can Be Removed From Script

Dim 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 Locations

Dim 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 Locations

Dim Ren : Ren = Array("%AUStart%\Kaspersky Anti-Virus Personal","%AUStart%\CCleaner","%AUStart%\Crimson Editor",_

"%AUStart%\DVD Decrypter","%AUStart%\Elaborate Bytes\CloneDVD2","%AUStart%\FlashGet")

Function MakeYourFolders

For Each StrMD In Loc

If Not Fso.FolderExist(StrMD) Then  Fso.CreateFolder(StrMD) End If

Next

End Function

Function AdmCopy

F1 =(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 FileList

Name = objFile.Name

Act.Popup "The File Path And Name" & vbCrLf & Name,7,"Test 001", 0 + 64 

Fso.CopyFile(F1),(Loc(2))

Next

Else

Act.Popup "Error In The Copy File" & vbCrLf & F1 & vbCrLf & "To Here" & vbCrLf & Loc(2), 10, 0 + 64

End If

End Function

Function SysTools

Set 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 Function

Function Jv16

Dim F1 : F1 =(AU_S & "\jv16 Powertools\jv16 PowerTools.lnk")

If Fso.FileExists(F1) Then

Fso.MoveFile(F1),(Loc(2))

Else

Act.Popup "Error In The Copy File" & vbCrLf & F1 & vbCrLf & "To Here" & vbCrLf & Loc(2), 10, 0 + 64

End If

End Function

Function DelShortCuts

Dim 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 Garbage

If Fso.FileExists(StrD) Then Fso.DeleteFile(StrD) End If

Next

End Function

Function ShortCutRename

If 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 If

If Fso.FolderExists(Ren(4)) Then

Fso.MoveFile(Ren(4) & "\CloneDVD2.lnk"),(AU_S & "\CDVD2.lnk")

End If

If Fso.FolderExists(Ren(5)) Then

Fso.MoveFile(Ren(5) & "\FlashGet.lnk"),(AU_S & "\FGet.lnk")

End If

End Function

'''' Start The Functions

MakeYourFolders

AdmCopy

SysTools

Jv16

ShortCutRename

Edited by gunsmokingman
Posted (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 by piXelatedEmpire
Posted

This is probably a bit simpler ;)

MOVE /Y "%AUStart%\Kaspersky Anti-Virus Personal\Kaspersky Anti-Virus Personal.lnk" "%AUStart%\Kaspersky.lnk"

Posted

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?

Posted

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.

Posted (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 by piXelatedEmpire
Posted

REN (or RENAME) <drive:>\<path>\filename1 filename2

You cannot however, specify a new drive or path for filename2.

Therefore in your case, I would suggest you use

MOVE <drive:>\<path>\filename1 <drive:>\<path>\filename2

as already stated by Achdine

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.

Posted
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 :yes:

Posted

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"

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...