Computing.Net > Forums > Disk Operating System > Create autostart.bat

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Create autostart.bat

Reply to Message Icon

Name: Frusti
Date: October 31, 2002 at 07:43:28 Pacific
OS: WinXP Proffesional
CPU/Ram: P4-2,4Ghz/512
Comment:

Hi all.

I have a question concerning a .bat file i created to launch a programm on a .pdf file on a CD.

The idea is the following:
1. The batchfile checkes the existance of an "adobe" folder on a computers HD.
1.1 If the folder doesn't exist, it should launch the "setup.exe" on the CD (which is the acrobat-setupfile)
1.2 If it does exist, it should launch the welcome.pdf file on the CD.

What i have so far is:
- autorun.inf to launch the .bat file on CD
- both setup.exe and welcome.pdf in the root of the CD

What i wrote in the batchfile is the following (i'm new at this so...don't laugh)

@ECHO OFF
@ECHO Checking the existance of Acrobat @ECHO Reader on your system
@ECHO OFF

IF EXIST C:\program~1\Adobe\NUL Goto Start2

IF NOT EXIST C:\program~1\Adobe\NUL Goto Start1

:Start1
START\Start32.exe
Goto End

:Start2
START2\Welcome.pdf
Goto End

:End

Now the C:\program~1\... should become some sort of variable that searches the whole drive for the "adobe" folder (but i don't know how to do that actually)

So the .bat doesn't do anything now when i insert the CD. it doesnt' launch the "start32.exe" OR the "welcome.pdf"

Any idea's on how i can fix this are more then welcome heh.

Tnx in advance



Sponsored Link
Ads by Google

Response Number 1
Name: Miskva
Date: October 31, 2002 at 10:31:06 Pacific
Reply:

OK

lets try this

============================================
@echo off

rem check for existance of Adobe program
if exist C:\progra~1\adobe\adobe.exe goto inst_ok

rem run setup
\setup.exe
echo Wait until setup is completed
pause

:inst_ok
rem run adobe with the pdf
C:\progra~1\adobe\adobe.exe \welcome.pdf
=============================================

now, this is assuming the adobe is always installed in C:\progra~1\adobe\adobe.exe, which may not be the case

searching for it, all across c:\progra~1, is just a little more difficult

try this, it may not be perfect, but its the correct way, I guess

btw: what is the start32.exe ?


0

Response Number 2
Name: Secret_Doom
Date: October 31, 2002 at 17:59:32 Pacific
Reply:

I think I have a better approach to this matter: checking if the .PDF files are already a recognized file type by the running system.

This will do it:

===== BATCH SCRIPT BEGIN =====
@echo off

type nul> %temp%.\T1.DAT
REGEDIT /E %temp%.\T1.DAT HKEY_CLASSES_ROOT\.PDF
FIND "\" < %temp%.\T1.DAT > nul
if not errorlevel=1 goto adobeOK

start /w \start.exe

:adobeOK
del %temp%.\T1.DAT
welcome.pdf
===== BATCH SCRIPT END =====

Though the detection for the .PDF file type works for both Win9x/WinXP, just entering the name of the .PDF file on Win9x won't open it with the proper program (just on WinXP). I won't cover that other matter, since Frusti didn't mention the script should work on multiple OS's.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

______________________________________________________


0

Response Number 3
Name: Frusti
Date: November 4, 2002 at 00:46:40 Pacific
Reply:

Secret_doom & Miskva,

I wanna thank you both for your effords to my question. Even though i knew my solution was veeery simplified, i had no idea the batch-file would be that complex (to my opinion).
In other words, without your supports i don't think i would have been able to get it together.

I tried the solution of secret_doom and it works perfect.
Even though the batch-file should be able to perform on different OS-systems, i tried it on XP & NT and in both cases he launches the welcome.pdf. Now i haven't tried on a comp yet that hasn't got acrobat installed yet, so that i still have to test.

To answer the question of Miskva: the start32.exe = the setup-file of acrobat (that should autorun if the programm would not be located on the comps HD).

If it wouldn't work on other OS's then the ones i tried, or if the start32.exe wouldn't launch on comps where acrobat aint installed in yet, i'll try to locate the problem first myself before contacting you (even though i aint such a .bat-wizard like you guys hehe).

So again, thanks for your help, cause i owe this all to you guys.

delighed greetz,

Frusti


0

Response Number 4
Name: Frusti
Date: November 15, 2002 at 07:15:01 Pacific
Reply:

Hi all.

I'm currently succesfully running the .bat file as suggested by Secret_Doom on WinXP.
So as you said, the .pdf-file doesn't launch on other OS's. Is there any way in which you can make it compatible with Win 9x and WinNT for that matter?

I've been searching on several scripting pages myself but i'm afraid that it's a little to complicated for beginner like me.

Sorry for bothering you guys about this again, but thanks in advance for taking my question into consideration.

Greetings,

Frusti


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Create autostart.bat

creating autoexec.bat www.computing.net/answers/dos/creating-autoexecbat/10531.html

.bat help closing iis services www.computing.net/answers/dos/bat-help-closing-iis-services/12290.html

Prepare Bat www.computing.net/answers/dos/prepare-bat/12413.html