Closed SamHills closed 2 years ago
Added in v3
argument: install
will always enable the redirect
argument: remove
will always remove the redirect
@SamHills, not sure if still interested, but that's the best I can offer atm. I don't think errorlevel would help much here, since all gets trough (if run as admin). As for the pause, it only does it if no arguments are specified. If install or remove, it does not.
Please provide an Install switch (and optionally an Uninstall switch). I install programs like this with a batch file that installs everything needed to configure a new Windows installation (or repair an existing one) in one swell foop. Its operation needs to be unambiguous regardless of whether it's a new installation or a repair or upgrade of an existing one. If -install is specified: If the program is installed already it is upgraded to the current version, else it is installed. If -uninstall is specified: If the program is installed it is uninstalled, else a message is printed "not found". If neither is specified, use the current behavior (install if not installed else uninstall). If both are specified, throw an error.
Furthermore, a method is needed to prevent the program from waiting for the user to press if it was called from a higher-level script. I suggest including a -nopause switch that if set, inhibits the $_Press_Enter at the end if there wasn't a fatal error.
The program must exit with ERRORLEVEL <> 0 if a fatal error occurs so the calling file can react accordingly.
If this is too much for you, I would be willing to do it for you.