home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,620 of 42,547   
   Stanley Daniel de Liver to Mark   
   Re: Check if drive is present before run   
   04 Apr 13 19:45:21   
   
   From: admin@127.0.0.1   
      
   On Wed, 03 Apr 2013 19:24:30 +0100, Mark  wrote:   
      
   > I've been using this for years, especially on network drives.   
   >   
      
   Not that many, it requires NT or greater!   
      
   "if exist N:\nul" used to work in DOS/W98, but maybe not now (can't test   
   here, no local network)   
      
      
   >   
   > REM Is Drive N: mapped?   
   > set _ready=true   
   > dir N: > "%temp%\tmp$$$.dir" 2>&1   
   > find "The device is not ready" "%temp%\tmp$$$.dir" > nul   
   > if %errorlevel% EQU 0 set _ready=false   
   > find "The system cannot find the path specified" "%temp%\tmp$$$.dir" >   
   > nul   
   > if %errorlevel% EQU 0 set _ready=false   
   > if exist "%temp%\tmp$$$.dir" del "%temp%\tmp$$$.dir"   
   >   
   > REM Continue if mapped   
   > if "%_ready%"=="true" (   
   > 	blah blah blah...   
   > )   
   >   
   > REM Complain if not mapped   
   > if "%_ready%"=="false" (   
   > 	blah blah blah...   
   > )   
   >   
   >   
      
      
   --   
   It's a money /life balance.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca