2

I'm trying to create a homemade installer that replicates the functionality of an MSI. I'm running into trouble setting the registry values for my app, specifically the UninstallString, which is supposed to run when you right-click a program and click Uninstall. This was my initial UninstallString:

regedit C:\path\to\app\uninstall.reg & rd /s /q C:\path\to\app

For some reason, the & was not interpreted correctly and it was passed as an argument to regedit, so I tried this

cmd /c "regedit C:\path\to\app\uninstall.reg & rd /s /q C:\path\to\app"

This worked fine, but it showed the console window while uninstalling. Following the advice here, I tried

start /min "..."

and

start /min cmd /c "..."

but they both resulted in an error from the Control Panel, saying the program "was already uninstalled." I also tried it the other way around:

cmd /c start /min "..."

But the black window still popped up.

Is it possible to make this work without having to show the console window?

Community
  • 1
  • 1
James Ko
  • 32,215
  • 30
  • 128
  • 239
  • try to add arguments in quotes like `regedit "C:\path\to\app\uninstall.reg" & rd /s /q "C:\path\to\app"` – Paul Nov 01 '15 at 01:25

1 Answers1

1

This worked:

cmd /c start /min cmd /c "..."

Gotta love Windows.

James Ko
  • 32,215
  • 30
  • 128
  • 239
  • 2
    That's because `start` isn't a standalone executable but an internal command of `cmd`. BTW I think you can make a vbscript uninstaller wrapper that won't show any console windows by using [`shell.run "cmd /c regedit ... & rd ...", 0`](http://stackoverflow.com/a/13142667/3959875) (also [autoelevation](http://superuser.com/a/764415/409372) might be a good thing) – wOxxOm Nov 01 '15 at 02:33