Get the new PortableApps.com Platform 10.0: Gorgeous themes, a full portable app store and advanced functionality
Announcing the World's Best Flash Drive: The PortableApps.com Companion | Did you see a malware warning on Friday?

How to run a batch file rather than an exe file

act4art - March 17, 2010 - 4:09pm

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?


( categories: )

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?)

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

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?

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

How about this?

	LaunchNow:
		SetOutPath "$PROGRAMDIRECTORY"
		ExecWait $EXECSTRING

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

I'll get me coat...

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

?

!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