Jump to content

Recommended Posts

Posted

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


Posted

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

Posted

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

  • 2 weeks later...

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