News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Using MASM32 to assign a PATH/DIR by VOLUME NAME over DRIVE LETTER

Started by MtheK, August 03, 2013, 04:16:25 AM

Previous topic - Next topic

dedndave

here's another (similar) approach
@echo off
for %%X in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%X:\temp\test.bat call %%X:\temp\test.bat

this one will CALL the \temp\test.bat file on any and all drive(s) from D-Z that it is found

Magnum

I am confused as to what exactly is being sought.

Lot of talented batch filers here.

Might try here.

https://groups.google.com/forum/?fromgroups&hl=en#!forum/alt.msdos.batch.nt
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

MtheK

  FYI; Here's an interesting problem when I use the VOLSER.BAT w/the FOR loop:

SET MyCURRdrive=
FOR %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
  IF EXIST %%d:%MyCURRdir%   SET MyCURRdrive=%%d
)

  After I eject a DVD+RW from my drive G, then run this .BAT, I get this CRITICAL STOP: "There is no disk in the drive. Please insert a disk into drive G:".
I can't get around this unless I go into explorer.exe, click on the drive, get
"insert a disc", cancel that, and then re-run the .BAT; the CRITICAL STOP then goes away. I do NOT get this using my own FINDVOL program.  Any Comments?

dedndave

there is probably a way to use CALL to avoid that - let me think on it, a bit   :P

nidud

deleted

MtheK

  Well, this is kinda what my FINDVOL program does, which doesn't get this
CRITICAL STOP, I think because I use:

         MOV   NEWMODE,SEM_FAILCRITICALERRORS     ; prevent a dialog box for drive failures
;                                                   * IE: CD/DVD
         INVOKE SetErrorMode,
                           OFFSET NEWMODE
         MOV   NEWMODE,EAX         ; now is previous mode


  Since VOLSER.BAT only shows the drive containing the last DIR/DSN searched,
what I do in my daily .BAT is to call both, VOLSER.BAT and my FINDVOL program.
I then compare the results, kinda to ensure that my program is working properly,
but any differences I find, I use the results of my program:


call VOLSER.bat
set MyCURRdriveV=%MyCURRdrive%

set CloneApplVol="021-IV ,021-V "
IF [%2] == [] GOTO NOADDLVOL
set CloneApplVol="%~2 "
:NOADDLVOL

call FINDVOL.bat %CloneApplVol%

IF [%MyCURRdrive%] == [%MyCURRdriveV%]  GOTO SAMEDRIVE3
echo %~n0 %date% %time% drive mis-match (mult VOLs?); using FINDVOL...
:SAMEDRIVE3
set MyCURRdriveV=

  But, due to this CRITICAL STOP in the VOLSER.BAT, the daily .BAT hangs.
It's the VOLSER.BAT that I want to fix, or if I'm forced to, to stop
using it. Sorry if I wasn't more specific in my question...


nidud

deleted

TWell

Using DIR's errorcode ?, look here

EDIT
@ninud
    pass that VolumeName from GetVolumeInformation() to variable too, if OP is interested that too ?

dedndave

interesting link

i was thinking of opening another shell with COMMAND /F
it's an undocumented switch that we used to use with win95/98   :P
when the Abort/Retry/Fail question came up for floppies, it automatically assumed Fail

MtheK

FYI: I fixed VOLSER.BAT. The 'IF EXIST' was the problem:

  IF EXIST %%d:%MyCURRdir%   SET MyCURRdrive=%%d

Now I use:

  DIR %%d:%MyCURRdir% >nul 2>&1 &&SET MyCURRdrive=%%d

and now, when I eject the DVD+RW, there is no longer a CRITICAL STOP pop-up.


Magnum

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave