You are here

How to run a batch file rather than an exe file

8 posts / 0 new
Last post
act4art
Offline
Last seen: 14 years 9 months ago
Joined: 2010-02-26 14:05
How to run a batch file rather than an exe file

Hello,

I have an app which should be started using
a batch file, rahter than an exe executable.
But have a problem with the line:

!define DEFAULTEXE "mybatch.cmd"

within/in my installer (nsi) script and it doesnt
work. How can I do such a task?

btw: The batch starts an exe executable and of cource
I can setup the exe executable in the nsi script, but
that exe executable of my app needs a parent Console-
Window (Process) to attach to that Console.
So I have to start that app using a batch file or that
app has not all functions.

Any Ideas?

act4art
Offline
Last seen: 14 years 9 months ago
Joined: 2010-02-26 14:05
Hello, is it not possible to

Hello,
is it not possible to start an app
within a batch file?
Please help. Thank you.

btw. The Website is very lame and seems
to be overloaded (by scripts?)

Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
This should do what your

This should do what your looking for:

ExecDos::exec "$EXEDIR\mybatch.cmd" "" ""

It will wait for 'mybatch.cmd' to end, before to proceed the nsis script.

Formerly Gringoloco
Windows XP Pro sp3 x32

act4art
Offline
Last seen: 14 years 9 months ago
Joined: 2010-02-26 14:05
Hello, I see. There was a

Hello,

I see. There was a misstake about my intention.
First I use the SumatraPDFPortable Source Directory
to start my own portable app

There is a file "SumatraPDFPortable.nsi" And I
changed that name to "MyAppPortable.nsi" and now
I have to set up my portabalized application wich
is started by setting up the lines

!define DEFAULTEXE "mybatch.cmd"
!define DEFAULTAPPDIR "My App"

The problem was only that the active dir is not
the application root "My App". The active dir is
the top dir of the whole Portable App dir.

I could fix that by adding "App\My App\"
in that batch file and the exe executable will
be found and can be started.

Anyway. And a last question.

Now I think it would be better if I can change
the active directory to the applications root
directory "[TOPPORTABLEAPPDIR]\App\My App"
before "mybatch.cmd" will be started

How can I do this?

Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
doesn't '$EXEDIR' do that

doesn't '$EXEDIR' do that already ?!?!
It will translate into the directory from where your NSIS executable is running.[TOPPORTABLEAPPDIR]

Anyway, it's a good start, by using an original .nsi script as a template.

Just learn as you go, by trail & error, that's how we all had to learn.

Formerly Gringoloco
Windows XP Pro sp3 x32

prapper
Offline
Last seen: 3 years 10 months ago
Developer
Joined: 2008-01-24 17:01
How about this?
	LaunchNow:
		SetOutPath "$PROGRAMDIRECTORY"
		ExecWait $EXECSTRING

EDIT: Sorry, that last one was from the Sudoko launcher. An easy mistake to make Smile

I'll get me coat...

act4art
Offline
Last seen: 14 years 9 months ago
Joined: 2010-02-26 14:05
Hello, yes, that's it. Puuuh,

Hello,

yes, that's it.
Puuuh, I tried "!cd" again and again, but didn't work.
Don't know why. The SetOutPath is the secret key in
this case. Thank you.

btw: But why doesn't work this var with the !cd command?
(can't compile -> compile error)

LaunchNow:
!cd "$PROGRAMDIRECTORY"
ExecWait $EXECSTRING

?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
!cd is compile-time

!cd is a compiler instruction, executed at compile time rather than at execution time. This cause the compiler to change the working directory, rather than the compiled process when it runs.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Log in or register to post comments