1.

Solve : batch file on cd to autorund a sellection of programe exe files?

Answer»

Hi can anyone help me. I have not written a batch file in a very long time @18 years and never had to do what I now need to do. I am trying to prepare a batch file for burning onto a cd/dvd that will allow me to offer the cd/dvd user a selection of programs to install. I have a code that will make the batch file executable. I suppose I am trying to product a file much like you will see on the free cd/dvd's given out with many mags these days. I use xp as my os but the file would have to be capable of executing on almost any windows based system from say 2000 to vista. Is there any one who can help. My request is genuine and I have just had a web site built at www.cadireland.com I am trying to put together a cd/dvd with all of the demo files on it. I am new to this field as you have probably guessed. If anyone knows of an business who could write this program for me that would also be an acceptable solution depending on cost and time taken to produce. I really appreciate your help thanks.This could be as elaborate or a simple as you want.

For simple, the batch file could run the proper installation program based on the user selection.

For elaborate, you could use Internet Explorer, write an HTML splash screen, complete with the company logo and some majestic art work , and run the proper installation program based on the user selection.

Either method would require an autorun.inf file which will kick start the process by pointing to and executing the batch file when the CD is inserted.

This might be a fun project. Hi Sidewinder, Thanks for responding. I had thought of the Autorun.inf file and was going to use

[Autorun]
open=master.exe
Icon=cadirelandlogo.jpg

I have a small free program that turns batch files into exe files so i would make the batch file an exe.called master and drop in my logo.

While I need the choices your suggestion of a web page is very appealing as it sounds much more flexible. Problem is what little knowledge I have about batch files I have none with html.

@echo off
cls
echo.
echo.
echo 1. ProgeCad
echo.
echo 2. ArchSoft
echo.
echo 3. Land Development Suite
echo.
echo 4. Design & Parking
echo.
echo.
choice /C:1234 /N " Enter your choice..... "
cls

if errorlevel 1 set errorlev=1
if errorlevel 2 set errorlev=2
if errorlevel 3 set errorlev=3
if errorlevel 3 set errorlev=4

echo.
echo.
echo Return Code = %errorlev%

echo.
@echo off
cls
:start
echo This is a loop
set choice=
set /p choice="Do you wish install another program? Press 'y' and enter for Yes: Or "N" for no "
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='y' goto start

Not sure if I have got this right been a very long time and never did anything with with the integration and complexity of this.

Having finished their installation the computer will need to restart. I would use the code.

echo.
shutdown-r-c"Computer needs to shutdown & restart to complete installation"-t,30

Again my problem is how to tie all of these together still show a welcome message and disclaimer and if POSSIBLE a little bit of artwork. Any suggestions and again thank you for your time.Simple is good.

You pretty much have everything in place. I streamlined a bit of your code.

Code: [Select]@echo off
:top
cls
echo.
echo.
echo. 0. Exit
echo.
echo 1. ProgeCad
echo.
echo 2. ArchSoft
echo.
echo 3. Land Development Suite
echo.
echo 4. Design and Parking
echo.
echo.
choice /C:01234 /N " Enter your choice..... "
cls

if errorlevel 5 goto park
if errorlevel 4 goto land
if errorlevel 3 goto arch
if errorlevel 2 goto cad
if errorlevel 1 exit /b

:cad
cad.exe
goto top

:arch
arch.exe
goto top

:land
land.exe
goto top

:park
park.exe
goto top

I made up the executable names, which you will need to change along with the relative paths. Errorlevels should be tested in descending sequence as the compare is equal or greater than.

Quote

I use xp as my os but the file would have to be capable of executing on almost any windows based system from say 2000 to vista

Choice is not installed on WinNT machines only Win9x (yes, they are still out there) although I hear they brought it back from the dead for Vista. You may have to query what OS the user is running and write another segment of code for WinNT, Win2000, and WinXP USERS that will use set /p

Quote
Again my problem is how to tie all of these together

Provided the compiled version of the batch file is NAMED master.exe, everything is tied together. Be sure to put the exe and the jpg icon in the root directory of the CD. Each of the support files for each selection can be in their own directory, but use relative paths as the CD drive letter will be different on different machines.

Quote
still show a welcome message and disclaimer and if possible a little bit of artwork

Forget the artwork. Batch files are text only and do not support graphics. You could create a splash screen with multiple echo commands and use ping to leave visible for say 5 seconds.

If you decide to go with a HTML solution let us know.

Note: During testing I used a USB thumb drive which is not supported for autoplay without some smoke and MIRRORS so my autorun.inf was a bit different than yours. The autorun.inf file you posted should work fine for a CD. Hi Sidewinder
Sorry for long delay in thanking you for your help with code. It was a neater solution.

I decided having looked at the limited nature of the result to write a html code. It has been very difficult and I am only now nearing completion. I did not ask for help as the pages of code were in some cases large and complex although I have through trial and error started to slim all of this down. It turned out to be quite a project linking all the pages of code in a similar manner to a web site. When finished I may publish on these forums the code pages should anyone else like to give it a try or offer some improvements. Once again thank you


Discussion

No Comment Found