How to compile DOS batch file into an .exe file?

A

anythingreally

Running some DOS batch file to install a program simply scares users off, so,
how could I turn/compile them an .exe with Window's interface for
alert/validation/status update etc? Preferably not to get too involved...

Thanks in advance.

Don
 
J

John McGaw

anythingreally said:
Running some DOS batch file to install a program simply scares users off, so,
how could I turn/compile them an .exe with Window's interface for
alert/validation/status update etc? Preferably not to get too involved...

Thanks in advance.

Don

I've never heard of any programs that could compile a .BAT into an .EXE but
why bother -- there are real install programs out there which will unpack,
create directories, install, make registry changes, etc. And some of them
are free. Try a Google search for "freeware install program" (without the
quotes) and see what pops up. Download and try some of the free ones -- one
of them will probably do the job.
 
G

GHalleck

anythingreally said:
Running some DOS batch file to install a program simply scares users off, so,
how could I turn/compile them an .exe with Window's interface for
alert/validation/status update etc? Preferably not to get too involved...

Thanks in advance.

Don

Anything simple, such as a *.bat file, converted into using
the Windows GUI is involved. The easiest is to change the
mindset of the end user with, perhaps, inserting comments and
pauses into the DOS *.bat file. Failing this, the alternative
might to be convert the DOS batch file into an *.exe file. Look
in Google...programs do exist to make the conversion.
 
B

Big_Al

John McGaw said this on 3/7/2009 8:47 PM:
I've never heard of any programs that could compile a .BAT into an .EXE
but why bother -- there are real install programs out there which will
unpack, create directories, install, make registry changes, etc. And
some of them are free. Try a Google search for "freeware install
program" (without the quotes) and see what pops up. Download and try
some of the free ones -- one of them will probably do the job.

Nullsoft Install software is one of them that comes to my mind. It
seems to be quite robust. Google should find its source. There's a
heck of a learning curve on it though.
 
A

anythingreally

Thank you all. I took a quick look at Nullsoft Install software, sounds
interesting, I don't mind learning curve, however, I wish there's some sort
of sample code or even write-up on creating a Windowish Installer for DOS
batch centric installation process/controls, I have about 10 batch files.
In the past, I've tried some batch file conversion tools (to .exe) but none
worked. The package is quite involved...
 
A

anythingreally

Read more on Nullsoft Install, the tutorial didn't seem to touch anything on
how to call DOS batch file etc., if I drop all the these batch files, and
re-start with this one, it may take much more efforts, the batch files are
wasted (they seem to be quite robust). thks.
 
P

Pegasus

anythingreally said:
Running some DOS batch file to install a program simply scares users off,
so,
how could I turn/compile them an .exe with Window's interface for
alert/validation/status update etc? Preferably not to get too involved...

Thanks in advance.

Don

There are a number of batch file compilers around but they all fail when it
comes to processing advanced commands. The best place to ask this question
would be alt.msdos.batch.nt. You'll find the top-notch experts on batch
files there.

Why should your users be scared off by batch files? Surely it all depends on
what interface you give them! Agreed, they will see a black screen instead
of a pretty GUI, but functionally there needs to be no difference to a
compiled file. You might also consider using VB Script files if you wish to
give your users some basic GUI and make your files a lot more powerful. As a
tiny example: Paste this following line into c:\test.vbs, then double-click
it:

msgbox "Do you want ketchup with your fries?", 4, "Test Dialog"
 
D

DL

There are a number of batch file compilers around but they all fail when it
comes to processing advanced commands. The best place to ask this question
would be alt.msdos.batch.nt. You'll find the top-notch experts on batch
files there.

Why should your users be scared off by batch files? Surely it all dependson
what interface you give them! Agreed, they will see a black screen instead
of a pretty GUI, but functionally there needs to be no difference to a
compiled file. You might also consider using VB Script files if you wish to
give your users some basic GUI and make your files a lot more powerful. As a
tiny example: Paste this following line into c:\test.vbs, then double-click
it:

msgbox "Do you want ketchup with your fries?", 4, "Test Dialog"

Thanks for the pointer of a better-suited NG, just sent a post there.
On the current DOS batch-driven installer, yes, functionally it works
fine and actually simpler, a user only needs to press a single key of
Y to start installation, however, as I mentioned today's younger
genertion/user expectation is beyond me... they expect GUI ...

On your VB sample script, nice, runs perfectly, now, you got me
started... how to call DOS Batch from VB script? did a quick search
for tutorial, the one found either too simple or not relevant to my
need...
 
P

Pegasus

message





There are a number of batch file compilers around but they all fail when
it
comes to processing advanced commands. The best place to ask this question
would be alt.msdos.batch.nt. You'll find the top-notch experts on batch
files there.

Why should your users be scared off by batch files? Surely it all depends
on
what interface you give them! Agreed, they will see a black screen instead
of a pretty GUI, but functionally there needs to be no difference to a
compiled file. You might also consider using VB Script files if you wish
to
give your users some basic GUI and make your files a lot more powerful. As
a
tiny example: Paste this following line into c:\test.vbs, then
double-click
it:

msgbox "Do you want ketchup with your fries?", 4, "Test Dialog"

Thanks for the pointer of a better-suited NG, just sent a post there.
On the current DOS batch-driven installer, yes, functionally it works
fine and actually simpler, a user only needs to press a single key of
Y to start installation, however, as I mentioned today's younger
genertion/user expectation is beyond me... they expect GUI ...

On your VB sample script, nice, runs perfectly, now, you got me
started... how to call DOS Batch from VB script? did a quick search
for tutorial, the one found either too simple or not relevant to my
need...

===============

Calling a batch file from a VB script can be a little tricky, depending on
things like file names with embedded spaces, redirections etc. Why not do it
the other way round: Call the VB script from a batch file:

@echo off
wscript.exe c:\dl.vbs
(put your batch file commands here)

If you're willing to play around, here is the reverse of the above:
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
oWshShell.Popup "Please wait while the PC settles down!", _
iDelay, "Message from your PC", 0
if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"

DQ = """"
sBatch = "c:\My Programs\Batch File.bat"
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ

The downloadable help file "script56.chm" would be a good starting point for
your first steps into VB Scripts. Look for help on the "Run" method.
 
D

DL

Thanks for the pointer of a better-suited NG, just sent a post there.
On the current DOS batch-driven installer, yes, functionally it works
fine and actually simpler, a user only needs to press a single key of
Y to start installation, however, as I mentioned today's younger
genertion/user expectation is beyond me... they expect GUI ...

On your VB sample script, nice, runs perfectly, now, you got me
started... how to call DOS Batch from VB script?  did a quick search
for tutorial, the one found either too simple or not relevant to my
need...

===============

Calling a batch file from a VB script can be a little tricky, depending on
things like file names with embedded spaces, redirections etc. Why not doit
the other way round: Call the VB script from a batch file:

@echo off
wscript.exe c:\dl.vbs
(put your batch file commands here)

If you're willing to play around, here is the reverse of the above:
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
 oWshShell.Popup "Please wait while the PC settles down!", _
 iDelay, "Message from your PC", 0
 if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"

DQ = """"
sBatch = "c:\My Programs\Batch File.bat"
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ

The downloadable help file "script56.chm" would be a good starting point for
your first steps into VB Scripts. Look for help on the "Run" method.- Hide quoted text -

- Show quoted text -

Where's dl.vbs? My XP box's C:\ root directory definitely don't have
it, WINDOWS directory and its subs neither. Did search against the
whole drive still to no avail. Your approach sounds good to me, now
let me try to understand your sample code:

' Section 1, define the installer to use VBscript
@echo off
wscript.exe c:\dl.vbs
(put your batch file commands here)
' my Main batch control script here, yes?

'Section 2, initialize the VScripting
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
oWshShell.Popup "Please wait while the PC settles down!", _
iDelay, "Message from your PC", 0
if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"
' 60 seconds, pretty long, why not instead of 30 or even less? Longer
safer?

' Section 3, program, components installation, the "meat" section
DQ = """"
sBatch = "c:\My Programs\Batch File.bat"
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ
'DQ for data qeue something?
'sBatch, is this guy my Main batch control script or the one at very
top? I'm confused here.
' also, c:\{My Programs} ' variable directory might be a challenge
since for now I can't care to which directory/folder the user extract
the zipped file to, I'm using generic reference like .\

Another related question, for a bunch of license agreements, the DOS
screen scrolls down fast upon reading, any sort VBscript bringing up a
window that can read them in, then with a label like You Agree to this
Agreement [x] and You Do not Agree to this Agreement [x] , Next
button at bottom would be superb. Doable?

Also, currently, I have one Main installer for XP OS and another for
Vista OS because each's installer is different (altogether I have over
10 batch files for different compoments or programs).
Two questions in this regard, a) I would still need them even under
VBscripting, correct? b) is there a way that VBscripting can detect
current OS? If so I could use just one Installer for either OS.

Many thanks.

Don
 
D

DL

Thanks for the pointer of a better-suited NG, just sent a post there.
On the current DOS batch-driven installer, yes, functionally it works
fine and actually simpler, a user only needs to press a single key of
Y to start installation, however, as I mentioned today's younger
genertion/user expectation is beyond me... they expect GUI ...

On your VB sample script, nice, runs perfectly, now, you got me
started... how to call DOS Batch from VB script?  did a quick search
for tutorial, the one found either too simple or not relevant to my
need...

===============

Calling a batch file from a VB script can be a little tricky, depending on
things like file names with embedded spaces, redirections etc. Why not doit
the other way round: Call the VB script from a batch file:

@echo off
wscript.exe c:\dl.vbs
(put your batch file commands here)

If you're willing to play around, here is the reverse of the above:
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
 oWshShell.Popup "Please wait while the PC settles down!", _
 iDelay, "Message from your PC", 0
 if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"

DQ = """"
sBatch = "c:\My Programs\Batch File.bat"
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ

The downloadable help file "script56.chm" would be a good starting point for
your first steps into VB Scripts. Look for help on the "Run" method.- Hide quoted text -

- Show quoted text -

In addition, on "script56.chm, I've downloaded it, the odd thing is,
content failed to be displayed, I'm getting
"The address is not valid" err msg, first time ever problem with
Windows Help File.
 
P

Pegasus

*** See below.


Where's dl.vbs? My XP box's C:\ root directory definitely don't have
it, WINDOWS directory and its subs neither. Did search against the
whole drive still to no avail. Your approach sounds good to me, now
let me try to understand your sample code:

*** "dl.vbs" is a the file you create yourself, using whatever lines of
*** VB Code you choose (e.g. the samples I posted in this thread).
*** I chose "dl" because they are your initials but, of course, any
*** name will do!

' Section 1, define the installer to use VBscript
@echo off
wscript.exe c:\dl.vbs
(put your batch file commands here)
' my Main batch control script here, yes?
*** Yes!

'Section 2, initialize the VScripting
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
oWshShell.Popup "Please wait while the PC settles down!", _
iDelay, "Message from your PC", 0
if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"
' 60 seconds, pretty long, why not instead of 30 or even less? Longer
safer?
*** It's your scenario, not mine!

' Section 3, program, components installation, the "meat" section
DQ = """"
sBatch = "c:\My Programs\Batch File.bat"
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ
'DQ for data qeue something?
*** DQ for "Double Quote" but again you can choose your own variable names.

'sBatch, is this guy my Main batch control script or the one at very
top? I'm confused here.
*** sBatch is a variable name that is defined two lines further up.

' also, c:\{My Programs} ' variable directory might be a challenge
since for now I can't care to which directory/folder the user extract
the zipped file to, I'm using generic reference like .\
*** You set it to suit your case at hand.

Another related question, for a bunch of license agreements, the DOS
screen scrolls down fast upon reading, any sort VBscript bringing up a
window that can read them in, then with a label like You Agree to this
Agreement [x] and You Do not Agree to this Agreement [x] , Next
button at bottom would be superb. Doable?
*** Yes, but since you're not telling us what generates this screen
*** I cannot tell. You may need to replace the "Run" method with
*** the "Exec" method.

Also, currently, I have one Main installer for XP OS and another for
Vista OS because each's installer is different (altogether I have over
10 batch files for different compoments or programs).
Two questions in this regard, a) I would still need them even under
VBscripting, correct? b) is there a way that VBscripting can detect
current OS? If so I could use just one Installer for either OS.
*** Yes, VB Script can detect the OS.

Many thanks.
*** You're welcome.

Don

*** Your questions are now getting quite VB Script specific.
*** The newsgroup "microsoft.public.scripting.vbscript is the
*** right place to post them.
*** About your nun-functional .chm file: You need to start a
*** new thread in this newsgroup, under your own name and
*** with its own topic, e.g. "Help file does not work".
*** I will now cease monitoring this thread.
 
H

HeyBub

anythingreally said:
Running some DOS batch file to install a program simply scares users
off, so, how could I turn/compile them an .exe with Window's
interface for alert/validation/status update etc? Preferably not to
get too involved...

Thanks in advance.

Don

Google "bat to exe" returns over 4 million hits. The first is:

"Bat To Exe-Converter converts batch-script files to EXE files. Some
features and differences to usual batch files: ghost applications;
additional binaries, icons, version information; hidden source."

http://www.download.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top