www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/15/02:23:36

From: Outsider <nonvalid_email AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.os.msdos.programmer
Subject: Re: Detecting Windows and Windows directory from DOS
Date: Wed, 15 Mar 2000 06:18:15 +0100
Organization: 'From' address is nonvalid, use 'Reply-To' address for email
Lines: 46
Message-ID: <38CF1D17.688A9870@yahoo.com>
References: <8am5ub$o0v$1 AT news6 DOT svr DOT pol DOT co DOT uk>
NNTP-Posting-Host: kob-bor-1-6.dsl.cybercity.dk
Mime-Version: 1.0
X-Trace: news.cybercity.dk 953097409 72591 212.242.6.73 (15 Mar 2000 05:16:49 GMT)
X-Complaints-To: abuse AT cybercity DOT dk
NNTP-Posting-Date: 15 Mar 2000 05:16:49 GMT
X-Mailer: Mozilla 4.08 [en] (Win16; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ben Davis wrote:
> 
> I need to write an installation program for my DOS game. I want to design it
> so that if it detects Windows 95 or higher it puts the game in the Start
> Menu.
> 
> I can detect Windows from DOS - that part's easy, as I use Allegro which has
> the function built in. But can I detect the actual Windows directory? How?
> 
> By the way, I have no decent experience or documentation on Windows
> programming. One day...
> 
> Ben Davis

If win.com is in the path...
    
    :: ckpath.bat
    :: Checks if a file (%1) is in the path
    @ECHO off
    IF "%rec%"=="01" GOTO recurs
    IF "%1"=="" FOR %%v IN (ECHO GOTO:end) DO %%v filename required
    IF exist %1 FOR %%v IN (ECHO GOTO:end) DO %%v %1 in current
      directory
    SET rec=01
    SET fil=%1
    %0 %path%

    :recurs
    SET rec=
    IF "%1"=="" FOR %%v IN (ECHO GOTO:end) DO %%v %fil% not in current
      directory or path
    IF exist %1.\%fil% GOTO found
    SHIFT
    GOTO recurs

    :found
    ECHO %fil% found in path
    SET fil=

    :end

-- 
Outsider
"If we must play the theological game, let us never forget that it
is a game. Religion, it seems to me, can survive only as a
consciously accepted system of make-believe." -- Alduous Huxley

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019