I need to execute a batch file as part of the un-install process in a Windows installer project (standard OOTB VS 2008 installer project-vdproj). One cannot execute a bat f
The wider you need to distribute your application, the more strongly I would recommend against scripted custom actions. I had written a bunch in the past, but I found that too many computers have problems running VBScript or JavaScript. I ended up rewriting them all in C++ to handle this situation. Here are a couple of posts that give an in-depth explanation on why you should avoid scripted custom actions:
I've run into this same problem and the issue is that you can't call WScript within the vbs file - you will need to JUST call CreateObject
ie.
Set WshShell = CreateObject( "WScript.Shell" )
command = "uninstall-windows-serivce.bat"
msgbox command
WshShell.Run ("cmd /C " & """" & command & """")
Set WshShell = Nothing
Windows Installer scripts generally run as System, unless you tell it otherwise. Is it possible that your batch file needs to be run by the interactive user?
In your installer class, are you overriding the Uninstall method:
Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
MyBase.Uninstall(savedState)
'Shell to batch file here
End Sub
And secondly, have you qualified the full path to the batch file?
What worked for me was to specify the full path of the .bat file.
Have you checked that the batch file is in the current directory as seen by the script? I would add another message showing the directory it is using to ensure it is actually trying to execute the batch file where you think it is located.