Hi
Jusat 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 this
Applications - Ms office , ect, ect
Communictations
Entertainment
Accesibility
System tools
Utilities - For most of the programs i install say nero & acdsee
Games
anyway any ideas wil be appeciated
Thnx guys
Page 1 of 1
Startmenu links batchfiles
#2
Posted 11 July 2005 - 07:27 AM
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
#4
Posted 14 July 2005 - 12:34 AM
Here A Vbs Script That Will Remove Files, Shortcuts In These Places.
Blue Text Is The Loctions It Checks In
Green 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\Programs
Here A Script To Test The Above Script.
Dim Garbage, Loc, strL, StrN, WF
Dim 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
Blue Text Is The Loctions It Checks In
Green 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.
Quote
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\Programs
Quote
Dim Garbage, Loc, strL, StrN, WF
Dim 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
#5
Posted 23 July 2005 - 07:28 AM
could you please explain do i use the top code or the bottom code
#6
Posted 23 July 2005 - 09:15 PM
The Top One Is The Script
The Bottom Script Is To test The top Script.
You would only need the top script.
The Bottom Script Is To test The top Script.
You would only need the top script.
Share this topic:
Page 1 of 1



Help
Back to top









