Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help !! 1

Status
Not open for further replies.

gavinr98

IS-IT--Management
May 6, 2004
18
0
0
US
I have created a vbscript that will search for a particular app and then once found I need to uninstall the app. The problem I am having is that I get an error when trying to run the uninstall, I get "The system cannot find the file specified" when I echo the path it is correct so I am not sure if I missed something here or not. Any help would be appreciated.

See script below...

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("scripting.FileSystemObject")

sProgramFiles = oShell.RegRead _
("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir")

sFile = sProgramFiles & "\VideoLAN\VLC\uninstall.exe"

WScript.Echo (sFile) 'for testing only

If oFSO.FileExists(sFile) Then
oShell.Run sFile /S, 1, True

WScript.Echo ("Installed...removing") 'for testing only

Else
WScript.Echo ("Not Installed") 'for testing only
WScript.Quit
End If
 
Try this
Code:
oShell.Run sFile & " /S", 1, True
 
Also, if the path of the file has spaces in it (such as Program Files, you will need to quote the entire string. Untested, but something like:
Code:
sFile = chr(34) & sFile & " /S" & chr(34)
oShell.Run sFile, 1, True
 
I'd try this:
Code:
sFile = Chr(34) & sProgramFiles & "\VideoLAN\VLC\uninstall.exe" & Chr(34)
oShell.Run sFile & " /S", 1, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top