Jump to content

Batch file querry


Analada

Recommended Posts

I've written a simple batch (using choice and copy) to install some files on to a win98 PC. Converted it to an EXE. It works fine when the .exe is placed on a hard drive and executed from there, but nothing happens at all when it is run from a CD-drive. (It doesn't run.)

I wonder if one of you batch gurus could help? TIA

Link to comment
Share on other sites


Does it work if you run the original batch-file (=not converted to exe) from a cd?

If it does, then something's gone wrong with the conversion or maybe the file needs to be able to write to the directory where it resides (temporarily?).

If you would post the file people could probably help you.

Link to comment
Share on other sites

Yes, the batch works from a CD drive, but NOT the exe.

As I said, the .exe works fine from a hard disk drive. This applies to ANY batch, even something trivial, such as "echo hello world"(so there's no point including code here).

ANYWAY, I guess I need to include the command interpreter COMMAND.COM with the .exe so that the program can execute? Does that sound plausible? Will try it in a minute but it's a bit of a pain to have to include it (will bloat the size yet more -- it's already large.) Any other possibilities?

NOW one more thing..What's a simple piece of batch code code I can use to determine if the destination PC OS is win98se or XP? TIA. (I'd be glad to post the finished stuff when it's debugged including links to the freeware which is used to convert batch to exe.)

Link to comment
Share on other sites

Yes, the batch works from a CD drive, but NOT the exe.

As I said, the .exe works fine from a hard disk drive. This applies to ANY batch, even something trivial, such as "echo hello world"(so there's no point including code here).

ANYWAY, I guess I need to include the command interpreter COMMAND.COM with the .exe so that the program can execute? Does that sound plausible? Will try it in a minute but it's a bit of a pain to have to include it (will bloat the size yet more -- it's already large.) Any other possibilities?

NOW one more thing..What's a simple piece of batch code code I can use to determine if the destination PC OS is win98se or XP? TIA. (I'd be glad to post the finished stuff when it's debugged including links to the freeware which is used to convert batch to exe.)

Set comspec might help on bootup, examining currentversion in the registry will identify which os is installed

Link to comment
Share on other sites

Does whatever program you are using to convert it to an EXE extract the batch file to the current folder then execute it? In which case it can't write to the cd.

Knowing what you are using for BAT to EXE conversion may help.

Link to comment
Share on other sites

Does whatever program you are using to convert it to an EXE extract the batch file to the current folder then execute it? In which case it can't write to the cd.

Knowing what you are using for BAT to EXE conversion may help.

Yes, that seems to be the case: it extracts it to the current folder...Hum...How do I get around that? (This is hopefully going to be distributed, and a person might well try and install from a CD-ROM rather than from its hard drive). Help appreciated!

Here is the link to freeware program, "Batch2Exe Converter v1.2". Beware that the icon/version information windows will give a workable .exe if used on on Win98, only on XP. But otherwise, i.e. ignoring these windows, it runs fine on Win98. Download and extract the English version from here:

http://www.f2ko.de/VersionsinfoB2E.html

Link to comment
Share on other sites

CORRECTION: apologies, should have read:

<Here is the link to freeware program, "Batch2Exe Converter v1.2". Beware that the icon/version information windows will NOT give a workable .exe if used on on Win98, only on XP. But otherwise, i.e. ignoring these windows, it runs fine on Win98.>

Link to comment
Share on other sites

Hey the edit button is your friend. :)

But at any rate it does not appear that that bat to exe app gives the option as to where it extracts the bat file to. And it should really be doing it to the temp folder anyway.

Try this: http://www.windowsitpro.com/Article/Articl...0569/50569.html I've used this method for VBS and CMD scripts. It will require that .NET be install on both the system you build it on and that version or greater on the target system you wish to run the script on. But it extracts the script to the temp folder then runs it. It also "encodes" it to make it more difficult to read.

Link to comment
Share on other sites

Hey the edit button is your friend. :)

But at any rate it does not appear that that bat to exe app gives the option as to where it extracts the bat file to. And it should really be doing it to the temp folder anyway.

Try this: http://www.windowsitpro.com/Article/Articl...0569/50569.html I've used this method for VBS and CMD scripts. It will require that .NET be install on both the system you build it on and that version or greater on the target system you wish to run the script on. But it extracts the script to the temp folder then runs it. It also "encodes" it to make it more difficult to read.

Spent time trying to find that £$! edit button...<Grrr>

Take your point but .NET is not possible really, since I want to make sure that it installs on the widest range of windows PCs. BTW I've not explored it yet but it seems that the bat2exe may extract to TEMP folder under some conditions. It appeared to be doing that this morning when I ran from my E:\ directory.

Was wondering if it could be forced to extract to a specific folder. I suppose in the worse case I could do a batch wrapper to install the exe to a specific folder. But that's a bit cumbersome.

Any other option you can see? Thanks for the feedback so far.

Link to comment
Share on other sites

As jaclaz mentions use xmsdsk to create a small ramdrive copy you batch exe to there,then execute your batch.exe.

If it complains copy command.com and set comspec to the ramdrive, and set up any memory manages if needed to run your app,

Link to comment
Share on other sites

As jaclaz mentions use xmsdsk to create a small ramdrive copy you batch exe to there,then execute your batch.exe.

If it complains copy command.com and set comspec to the ramdrive, and set up any memory manages if needed to run your app,

Thanks, I'll try that. Be useful to have the flexibility. I guess (?) xmsdsk is from:

http://www.uwe-sieber.de/util_e.html

I've flagged up the "bug"/feature to the Author so maybe there will be a fix forthcoming - to let the user choose the install folder or default to %TEMP%. Feel free to email him :-)

MEANWHILE, came across this:

http://www.chilkatsoft.com/ChilkatSfx.asp

It's FREEWARE. I thought there must be a catch but it does seem genuine. It's very flexible and incredibly easy to use. Only requirement is for the batch to be first zipped, and since there is freezip (different website, or winzip non-free) to do that, it seems like a good solution. I'll probably do both and see which is better solution for win98/XP.

The chilkatsoft solution means that you don't have to add additional libraries to get dual solutions for win98/XP, as, for instance, choice.exe to get CHOICE command interpreted by winXP.

What do you think? Spot any drawbacks?

Link to comment
Share on other sites

Just for the record:

1) xmsdsk is by Franck Uberto

2) actually I had in my mind the normal ramdisk.sys, as I doubt that more than 32 Mb is needed to run a batch :w00t:

3) there is also another RAMDISK that has gone Opensource:

http://sourceforge.net/projects/srdisk

4) there are more .bat compilers, here are some of them:

ftp://gatekeeper.dec.com/pub/micro/pc/sim...tl/bat2ex15.zip

ftp://ftp.sac.sk/pub/sac/utiltask/batl173.zip

http://www.filegate.net/bfds/dosutl02.zip

http://www.filegate.net/bfds/rbatch1.zip

You might want to try them before implementing a more complex solution.

jaclaz

Link to comment
Share on other sites

Just for the record:

1) xmsdsk is by Franck Uberto

2) actually I had in my mind the normal ramdisk.sys, as I doubt that more than 32 Mb is needed to run a batch :w00t:

3) there is also another RAMDISK that has gone Opensource:

http://sourceforge.net/projects/srdisk

4) there are more .bat compilers, here are some of them:

ftp://gatekeeper.dec.com/pub/micro/pc/sim...tl/bat2ex15.zip

ftp://ftp.sac.sk/pub/sac/utiltask/batl173.zip

http://www.filegate.net/bfds/dosutl02.zip

http://www.filegate.net/bfds/rbatch1.zip

You might want to try them before implementing a more complex solution.

jaclaz

Just thought xmsdsk might also be useful for any further times Analada might wish to use ramdisk, and at 20k in size its not going to fill the cdrom up much :P

Analada search in google lots of download places

HTH

Link to comment
Share on other sites

I've had that 'bat2exe' program since the old DOS days. It's a neat trick, but a lot of work for no more advantage than it gives. The only real application for it seems to be to lock a batch file so no-one can read or modify it.

Ok, so I've got a batch file that someone compiled into an .exe file and I want to carry it around on a CD and run it on various computers. Here's what I'd do.

Prepare a folder for the cd and put my .exe file into it,

Add a little batch file to copy the .exe file to C:\ and run it.

If leaving it on c: is a problem, add a closing line to the batch

file to delete the .exe once it's run. Finito! :thumbup

Just a thought,

B)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...