ZileXa Posted February 21, 2011 Share Posted February 21, 2011 Hi,For a little project, I want to do something I know is possible but forgot how to. I have done this a few years ago.The idea: create a .cmd to install something e.g. copy files around and add uninstall info.Now create a second .cmd to uninstall e.g remove files and uninstall info.Now that we have install.cmd and uninstall.cmd, the idea is to combine both in installer.cmd,Installer.cmd consists of two parts:: INSTALLCOPY ....GOTO EOF: UNINSTALLDEL ...GOTO EOFEXITNow it should be possible to run the batch file like this:installer.cmd INSTALL --> this would call the INSTALL part and skip the Uninstall part.installer.cmd UNINSTALL --> this would call the UNINSTALL part and skip the Install part.Unfortunately, I am missing something because this is not working... but the idea is possible. Help appreciated! Link to comment Share on other sites More sharing options...
allen2 Posted February 21, 2011 Share Posted February 21, 2011 You could add at the begining something like this. Link to comment Share on other sites More sharing options...
Yzöwl Posted February 21, 2011 Share Posted February 21, 2011 Here is an example based on your sample which may help.@ECHO OFFECHO=%~1 | FINDSTR/BI [//-][UI] >NUL || ( ECHO=To use this file you must use an appropriate switch & ECHO= ECHO= -u ^| -U ^| /u ^| /U Unistallation Routine & ECHO= ECHO= -i ^| -I ^| /i ^| /I Istallation Routine & ECHO= PAUSE & GOTO :EOF)SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSIONSET "_P=%~1"IF /I %_P:~1,1% EQU U GOTO UNIREM Installation tasks go below here::ExampleECHO=COPY ....GOTO :EOF:UNIREM Uninstall tasks go below here::ExampleECHO=DEL ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now