advancedservers Posted July 11, 2005 Posted July 11, 2005 HiJusat wondering if anyone can help me make a startmenu batch file that checks to see if a shortcut exist say "%AllUsersProfile%\Start Menu\Programs\nero" then del "%AllUsersProfile%\Start Menu\Programs\nero" then run a self extractin sfx file.i like to install my start menu like thisApplications - Ms office , ect, ectCommunictationsEntertainmentAccesibilitySystem toolsUtilities - For most of the programs i install say nero & acdseeGamesanyway any ideas wil be appeciatedThnx guys
jbm Posted July 11, 2005 Posted July 11, 2005 You'll have to modify this to delete the right short cut and ruun your sfx.IF EXIST "%AllUsersProfile%\Start Menu\Programs\nero\nero startsmart.lnk" ( del "%AllUsersProfile%\Start Menu\Programs\nero\nero startsmart.lnk" start /wait myselfextracting.exe)exit
gunsmokingman Posted July 14, 2005 Posted July 14, 2005 Here A Vbs Script That Will Remove Files, Shortcuts In These Places.Blue Text Is The Loctions It Checks InGreen Text Is Where You Would Put The Files Or Shortcuts In To Delete The Files That Are Listed In There Is What I Used To Test This Script. Dim Act : Set Act = CreateObject("Wscript.shell") Dim AUP : AUP = Act.ExpandEnvironmentStrings("%ALLUSERSPROFILE%\Start Menu") Dim AUPP : AUPP = Act.ExpandEnvironmentStrings("%ALLUSERSPROFILE%\Start Menu\Programs") Dim UP : UP = Act.ExpandEnvironmentStrings("%UserProfile%\Start Menu") Dim UPP : UPP = Act.ExpandEnvironmentStrings("%UserProfile%\Start Menu\Programs") Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") Dim DFile, DFile1, Garbage, StrDF, StrFD, StrFD1 '''' PLACE FILE TO DELETE IN GARBAGE, THESE ARE ONLY THE TEST FILES LISTED IN THE ARRAY Garbage = Array("New Text Document.txt","Eddie.txt","Test.txt","Some Other Folder\Test.txt",_ "Some Other Folder\New Text Document.txt","Some Other Folder\Eddie.txt") Function FDel1 Fso.DeleteFile(DFile) End Function Function FDel2 Fso.DeleteFile(DFile1) End Function Function MFile1 End Function Function Mfile2 End Function Function RMF1 For Each strDF in Garbage StrFD = (AUP & "\" & StrDF) StrFD1 = (AUPP & "\" & StrDF) DFile = (AUP & "\" & StrDF) DFile1 = (AUPP & "\" & StrDF) If Fso.FileExists(AUP & "\" & strDF) Then FDel1() Else MFile1() End If If Fso.FileExists(AUPP & "\" & strDF) Then FDel2() Else MFile2() End If Next End Function Function RMF2 For Each strDF in Garbage StrFD = (UP & "\" & StrDF) StrFD1 = (UPP & "\" & StrDF) DFile = (UP & "\" & StrDF) DFile1 = (UPP & "\" & StrDF) If Fso.FileExists(UP & "\" & strDF) Then FDel1() Else MFile1() End If If Fso.FileExists(UPP & "\" & strDF) Then FDel2() Else MFile2() End If Next End Function RMF1 '''' Start The Check In %ALLUSERSPROFILE%\Start Menu And %ALLUSERSPROFILE%\Start Menu\Programs RMF2 '''' Start The Check In %UserProfile%\Start Menu\Programs And %UserProfile%\Start Menu\ProgramsHere A Script To Test The Above Script.Dim Garbage, Loc, strL, StrN, WFDim Fso : Set Fso = CreateObject("Scripting.FileSystemObject") Dim Act : Set Act = CreateObject("Wscript.shell") Dim AUP : AUP = Act.ExpandEnvironmentStrings("%ALLUSERSPROFILE%\Start Menu") Dim AUPP : AUPP = Act.ExpandEnvironmentStrings("%ALLUSERSPROFILE%\Start Menu\Programs") Dim UP : UP = Act.ExpandEnvironmentStrings("%UserProfile%\Start Menu") Dim UPP : UPP = Act.ExpandEnvironmentStrings("%UserProfile%\Start Menu\Programs") Garbage = Array("\New Text Document.txt","\Eddie.txt","\Test.txt") Loc = Array((AUP),(AUPP),(AUPP & "\Some Other Folder"),(UP),(UPP),(UPP & "Some Other Folder")) If Not Fso.FolderExists(AUPP) Then Fso.CreateFolder(AUPP) Else On Error Resume Next End If If Not Fso.FolderExists(UPP) Then Fso.CreateFolder(UPP) Else On Error Resume Next End If For Each strL in Loc For Each StrN In Garbage Set WF = fso.OpenTextFile( strL & StrN,2, true) WF.WriteLine "Hello It My Test" WF.Close Next Next Act.Popup "Completed", 3 ,"End", 0 + 32
advancedservers Posted July 23, 2005 Author Posted July 23, 2005 could you please explain do i use the top code or the bottom code
gunsmokingman Posted July 24, 2005 Posted July 24, 2005 The Top One Is The ScriptThe Bottom Script Is To test The top Script.You would only need the top script.
advancedservers Posted July 24, 2005 Author Posted July 24, 2005 sorry i should od read what you typedThanks again
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