Using MSDOS-Commandline commands in NSIS
I would like to know how could I execute MSDOS commands in .nsi script. Is it possible to do this or not, if no what can I use instead to achieve the same results.
Thanks in advance.
Archive: Using MSDOS-Commandline commands in NSIS
Using MSDOS-Commandline commands in NSIS
I would like to know how could I execute MSDOS commands in .nsi script. Is it possible to do this or not, if no what can I use instead to achieve the same results.
Thanks in advance.
Take a look in the documentation for Exec, ExecShell and ExecWait. I would gather one of those functions should be able to do what you want.
Exec or ExecWait: Executes the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory.
Eg.
ExecWait 'MSDE 2000A\setup.exe SAPWD=pas INSTANCENAME=MyInstance TARGETDIR="$INSTDIR\MSDE 2000A\" /qn'
Exec command executes programs .exe or any other extension.
What i would like to know is how could I execute this command in NSIS script:
,%CATALINA_HOME%\bin\tomcat.exe -install My-Tomcat %JAVA_HOME%\jre\bin\server\jvm.dll -Djava.class.path=%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar -Djava.endorsed.dirs=%CATALINA_HOME%\common\endorsed -Dcatalina.home=%CATALINA_HOME% -server -Xms128m -Xmx512m -Xrs -start org.apache.catalina.startup.BootstrapService -params start -stop org.apache.catalina.startup.BootstrapService -params stop -out %CATALINA_HOME%\logs\stdout.log -err %CATALINA_HOME%\logs\stderr.log,
Why not make a batch file and execute that?
-Stu
nsExec plug-in also can hide DOS window and redirects output to log file or stack. Please read NSIS/Contrib/nsExec/nsExec.txt for command line format. You will need to replace %% parameters with NSIS script variables.
I see very long command lines (line) in your post and this may even increase with real paths instead of %%, please note - Windows defines MAX_PATH = 260 characters.
How would I execute the following commandline command using nsExec::Exec:
'osql -E -SserverName\LA \
RESTORE DATABASE MyDatabase \
FROM DISK = 'C:\LA\MSDE 2000A\Backup\MyDatabase ' \
WITH RECOVERY, \
MOVE "MyDatabase_Data" TO "C:\LA\MSDE 2000A\MSSQL$LA\Data\MyDatabase.mdf", \
MOVE "MyDatabase_Log" TO "C:\LA\MSDE 2000A\MSSQL$LA\Data\MyDatabase.ldf" \
GO'
Is it simply executed as follows:
nsExec::Exec 'osql -E -SserverName\LA \
RESTORE DATABASE MyDatabase \
FROM DISK = 'C:\LA\MSDE 2000A\Backup\MyDatabase ' \
WITH RECOVERY, \
MOVE "MyDatabase_Data" TO "C:\LA\MSDE 2000A\MSSQL$LA\Data\MyDatabase.mdf", \
MOVE "MyDatabase_Log" TO "C:\LA\MSDE 2000A\MSSQL$LA\Data\MyDatabase.ldf" \
GO'
Yes, but will it always be C:\LA\... on the user's system?
If it isn't then you should substitute it for a variable which will contain the path either entered by the user or for example read from the registry.
-Stu
OK, so the correct way of using nsExec::Exec command will be, as follows:
nsExec::Exec 'osql -E -S$ServerName\LA \
RESTORE DATABASE MyDatabase \
FROM DISK = $InstDir\MSDE 2000A\Backup\MyDatabase ' \
WITH RECOVERY, \
MOVE "MyDatabase_Data" TO "$InstDir\MSDE 2000A\MSSQL$LA\Data\MyDatabase.mdf", \
MOVE "MyDatabase_Log" TO "$InstDir\MSDE 2000A\MSSQL$LA\Data\MyDatabase.ldf" \
GO'
Yer or No
And by the way thank you very match to all, for all the help.