Old 10th November 2004, 14:31   #1
bgosalci
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 10th November 2004, 15:11   #2
rsegal
Senior Member
 
rsegal's Avatar
 
Join Date: Feb 2003
Location: Toronto, Canada
Posts: 227
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.
rsegal is offline   Reply With Quote
Old 10th November 2004, 15:23   #3
bgosalci
Guest
 
Posts: n/a
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,
  Reply With Quote
Old 10th November 2004, 16:49   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Why not make a batch file and execute that?

-Stu
Afrow UK is offline   Reply With Quote
Old 10th November 2004, 16:54   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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.
Takhir is offline   Reply With Quote
Old 10th November 2004, 17:21   #6
bgosalci
Guest
 
Posts: n/a
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'
  Reply With Quote
Old 10th November 2004, 18:39   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 10th November 2004, 21:49   #8
bgosalci
Guest
 
Posts: n/a
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.
  Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump