Re: [Freedos-user] if not exist MD XXX
Hi, On Thu, May 12, 2011 at 8:50 PM, Ray Davison wrote: > > Is there such a batch command? if not exist mydir/nul md mydir Doesn't work on XP (I think?), but that's the typical "DOS" way. (BTW, I'm sure DR-DOS and 4DOS have better methods, if you use their shells instead. Can't remember exactly, probably "isdir" and/or "direxist".) -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] if not exist MD XXX
Hey, > if not exist mydir/nul md mydir > > Doesn't work on XP (I think?), but that's the typical "DOS" way. This kept bothering me for some reason, so I checked now. It appears to work just fine on MSW NT command lines, executing the command after "if not exist dir\nul" if and only if that directory doesn't exist. In NTVDM, it does work as well (only?) using the COMMAND.COM supplied with NT; however, with other COMMAND.COMs (including FreeCOM) it indeed doesn't work: device names (such as NUL and CON) apparently aren't found. So while checking for a directory's existence with this method might work in non-DOS NT batch scripts, it can't be relied upon because the NTVDM's DOS interfaces appear not to find device names. Regards, Christian -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] if not exist MD XXX
Hi Christian, >> if not exist mydir/nul md mydir >> >> Doesn't work on XP (I think?), but that's the typical "DOS" way. > > This kept bothering me for some reason, so I checked now. > > It appears to work just fine on MSW NT command lines, executing the > command after "if not exist dir\nul" if and only if that directory doesn't > exist. In NTVDM, it does work as well (only?) using the COMMAND.COM > supplied with NT; however, with other COMMAND.COMs (including FreeCOM) it > indeed doesn't work: device names (such as NUL and CON) apparently aren't > found. As far as I remember, the DOS findfirst API is supposed to find character devices (such as NUL) in any (existing) directory, so this would depend more on DOS than on COMMAND, but I am not sure. Eric -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] if not exist MD XXX
Hi Eric, > As far as I remember, the DOS findfirst API is supposed to find > character devices (such as NUL) in any (existing) directory, so > this would depend more on DOS than on COMMAND, but I am not sure. Without any further investigation, I'd say that's part of it. However, aside from the MSW program cmd.exe (which obviously doesn't use NTVDM-DOS's FindFirst) the NTVDM-COMMAND program (which at least partly works as V86-mode DOS program) does find the devices too. I guess it might not use the NTVDM-DOS interfaces internally and hence finds the devices. This would indicate NTVDM-DOS's FindFirst and FindNext are broken (incompatible) in some way as you suggested. I didn't get into the specifics earlier 'cause I didn't think it was necessary. Regards, Christian -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user