Computing.Net > Forums > Disk Operating System > Create Autorun.bat Multiple OS's

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 Autorun.bat Multiple OS's

Reply to Message Icon

Name: Frusti
Date: November 15, 2002 at 07:27:26 Pacific
OS: Win XP Professional
CPU/Ram: P4 2,4Ghz/512
Comment:

Hi all,

I'm currently running an autorun.bat-file as suggested by Secret_Doom (see posting on 31 Oct).
As for now, the .bat file looks like this:

@echo off

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

start /w \AcroReader51_ENU.exe

CLS
EXIT

:adobeOK
del %temp%.\T1.DAT
welcome.pdf

CLS
EXIT

What the .bat-file does, is launching a certain .pdf-file (in this case welcome.pdf) when the cd is inserted.
If the acrobat programm is not located, it automatically launches a setup-file from Acrobat Reader.

As Secret_Doom said, the .pdf file doesn't launch itself on other OS's as Win XP.
On Win NT the bat doesn't run at all. Not the .pdf OR the Acrobat-setup.

I tried figuring out myself how to rewrite the .bat file so it would become compatible with Win 9x and Win NT, but the scripts i saw on the internet are a bit over my knowledge to generate it myself.

Can i call upon the help of you guys again to help me out a bit with this?

I thank you in advance,

Frusti



Sponsored Link
Ads by Google

Response Number 1
Name: Frusti
Date: November 15, 2002 at 07:48:31 Pacific
Reply:

Maybe to give a bit more info:

This .bat-file is located in the root of a CD, and is launched by a autorun.ini-file.

Both welcome.pdf and AcroReader51_ENU.exe are located in the root of the disc.

If any other information is needed, i'd be delighted informing you.

Delighted greetings,

Frusti


0

Response Number 2
Name: Secret_Doom
Date: November 16, 2002 at 14:34:44 Pacific
Reply:

First of all, that's not exately the script I suggested. The script in this subject is the right one (you had some posting problems and the line with the FIND cmd was changed, affecting the whole script.

I've developed a batch file to do what you asked, Frusti. It's below. Read commented lines from its begginning to know exately what it does:

===== BATCH SCRIPT BEGIN =====
:: ==============================================
:: Author: Leonardo Pignataro (secret_doom@hotmail.com)
:: ==============================================
:: Performed tasks:
:: 1. Detect if .pdf files are known
:: 2. If true, jump to step 5
:: 3. If false {
::    on the 1st time, run Adobe Acrobat installation
::    on the 2nd time, exit, since the installation failed or was cancelled
:: }
:: 4. Return to step 1
:: 5. Locate program associated and open \welcome.pdf
:: ==============================================
:: Designed and tested under Windows 98 SE and Windows XP Pro
:: ==============================================
@echo off
if "%1"=="GoTo" goto %2

%comspec% /e:2048 /c %0 GoTo start
goto eof

:start
set OPSYS=9x
if "%OS%"=="Windows_NT" set OPSYS=NT
set err=0
set T1=%temp%.\T1.BAT
set T2=%temp%.\T2.DAT
goto start_%OPSYS%

:start_9x
type nul> %T2%
REGEDIT /E %T2% HKEY_CLASSES_ROOT\.pdf
FIND "@=" < %T2% > %T1%
if errorlevel=1 goto install
echo l103> %T2%
echo eED BE 00 01 89 F7 A4 80 3C 22 74 02 E2 F8>> %T2%
echo eFA 89 F9 81 E9 00 01 53 45 54 20 4B 3D>> %T2%
for %%? in ("g=ED 100" w q) do echo %%?>> %T2%
DEBUG %T1% < %T2% > nul
echo.>> %T1%
call %T1%
type nul> %T2%
REGEDIT /E %T2% HKEY_CLASSES_ROOT\%K%\shell\open\command
FIND "@=" < %T2% > %T1%
echo lFD> %T2%
echo e00 B8 00 00 BE 00 01 BF FE 00 80 7C 01 22 74 05 C6>> %T2%
echo e10 05 22 47 40 80 3C 22 74 19 80 3C 5C 75 01 46 3D>> %T2%
echo e20 01 00 75 0B 80 7C 02 22 75 05 C6 05 22 47 40 A4>> %T2%
echo e30 EB E2 89 F9 81 E9 FE 00>> %T2%
for %%? in ("g=0 38" wFE q) do echo %%?>> %T2%
DEBUG %T1% < %T2% > nul
echo.>> %T1%
call %T1% \welcome.pdf
for %%? in (%T1% %T2%) do del %%?
goto eof

:: Replace the strings {TAB} by the TAB character itself
:start_NT
set K=
(for /F "tokens=3 delims={TAB}" %%I in ('
    REG QUERY HKCR\.pdf /ve') do set K=%%I) 2> nul
if "%K%"=="" goto install
for /F "tokens=3 delims={TAB}" %%I in ('
    REG QUERY HKCR\%K%\shell\open\command /ve') do echo start %%I> %T1%
call %T1% \welcome.pdf
del %T1%
goto eof

:install
if "%err%"=="1" goto eof
set err=1
start /w \AcroReader51_ENU.exe
goto start_%OPSYS%

:eof
===== BATCH SCRIPT END =====

Notice the two red string ("{TAB}"). You should replace those strings by the TAB character itself. For that, use NOTEPAD. Do NOT use EDIT.COM, because that program will add spaces, not the tab character itself.

So, is that what you needed? Does it work on NT?

-- Leonardo Pignataro - Secret_Doom --

PS: Don't waste your time trying to understand the batch script throughly, it is extremely complex and also involves debug / assembler concepts. I don't think I would understand it myself if it was written by someone else, not without comments.

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

____________________________________________________________________


0

Response Number 3
Name: Frusti
Date: November 17, 2002 at 01:15:14 Pacific
Reply:

Hey Secret_Doom,

First of all i wanna thank you for having helped me out (AGAIN). You were right about the difficulty of the batchile...When i see what wrote up there, there's no way i could have fixed it myself, not even talking about understanding it heh.

The only problem i'm still having is the tab-character. i tried to do the notepad-thing you suggested, but instead of a character i get the tab-space on my screen (as you also get with edit.com) So i'm currently trying to find out what character i should replace the string with...
could you maybe past & copy it for me ?

I will let you know for sure if the file worked on NT. So far i haven't been able to test it myself due to the little tab-character-problem, but again, i cannot thank you enough for having helped me through this.

Delighted thanks,

Frusti


0

Response Number 4
Name: Secret_Doom
Date: November 17, 2002 at 08:59:42 Pacific
Reply:

Hello, Frusti.

When you add the TAB character on NOTEPAD, it does really add the TAB character, not some spaces. Although, what you see is a long space, which could have been formed of some spaces (but it's not). However, if you pass the blinking cursor (the one which marks where you're writing) through that big space, you'll notice it will jump the whole space, won't walk one space at a time as if it was formed of some spaces.

After copying and pasting the script, making the line ":eof" the last line (no blank lines before it) and exchanging the {TAB}'s, the file should be 2186 bytes long.

Another tip which will help you to know if you've done it right: if you put spaces instead of the TAB char, even if .PDF files are recognized on your system, the script will act as if they weren't (so, it will try to run the adobe installation).

I don't think copying-pasting the character would work.

-- Leonardo Pignataro - Secret_Doom --

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


0

Response Number 5
Name: Secret_Doom
Date: November 17, 2002 at 10:51:34 Pacific
Reply:

Hey, forget what I said about the script size, that strangly depends on the OS you're viewing its size...

Just put the TAB via NOTEPAD (works either on Win98 or on WinXP) and test the script, even if you see a big space (that's what you're supposed to see). If the script works on WinXP, it's because you've done it right.

-- Leonardo Pignataro - Secret_Doom --

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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






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 Autorun.bat Multiple OS's

Create autostart.bat www.computing.net/answers/dos/create-autostartbat/12030.html

OS's interchange www.computing.net/answers/dos/oss-interchange/7084.html

how to check IIS in a batch file www.computing.net/answers/dos/how-to-check-iis-in-a-batch-file/14346.html