Finding an extension -VBSCRIPT

5 pts.
Tags:
VBScript
I need help with a script I am working on. I am looking to find a file by extension, put that script in the All Users profile and have it run on startup. The problem is I need the script to go out search the C: drive and find the file by the file extension not the file name. I have written a similar program here that finds it via the full file name. If anyone can help it would be really appreciated.
set wshShell=CreateObject("Wscript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strCompName = objNetwork.ComputerName

'CSG Startup
If Instr(1,LCase(strCompName),"VCAE",1) > 1 Then

wshShell.run chr(34) & "C:Program FilesAvayaAvaya IP AgentIpAgent.exe" & chr(34) & "/lang enu",1,true

ElseIf objFSO.FileExists("C:Documents and SettingsAll UsersStart MenuProgramsCSG Systemsacsr.lnk") Then
wshShell.run chr(34) & "C:Documents and SettingsAll UsersStart MenuProgramsCSG Systemsacsr.lnk" & CHR(34),1,false

Else wshShell.run chr(34) & "C:Documents and SettingsAll UsersStart MenuProgramsCSG Systemsnt acsr.lnk" & CHR(34),1,false

End If
'Rumba Startup

If objFSO.FileExists("C:Program FilesWallDataMFRAMErumbaprt.exe") Then
wshShell.run chr(34) & "C:Program FilesWallDataMFRAMErumbaprt.exe" & CHR(34),1,false

End If

Answer Wiki

Thanks. We'll let you know when a new response is added.
if right(filename,4) =".lnk" then...

I have some VBScript code that I use to delete files … I would suggest looking at my code and using as is or incorporating the useful code into your script.

Code is at Code-Bytes.

Additional details are also on the page.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    if right(filename,4) =".lnk" then... In the above script, where should this line be placed ?
    70,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following