I had tried searching, but I guess I wasn't doing it right. I was thinking the problem I encountered was related to IP being an mIRC keyword. I thought I recalled the problem with filenames being a device name prevented writing to them at all, and I was able to create ip.txt in a DOS window just fine.

I assume all devices are blocked because of the risk of allowing it with the wrong ones. For example I recall back in the 90s, I can't remember whether it was mIRC or a different chat client, where you could crash someone by inducing them to try to play clock$.wav

It just seems strange that with these special device names that $isdir requires the ending backslash on the path, but then mkdir allows you to create the foldername, yet bombs out with an error message saying it didn't do so.