VOGONS


First post, by Malvineous

User metadata
Rank Oldbie
Rank
Oldbie

Hi everyone,

In DOSBox 0.65 (under Linux at least) if you try to create a file with brackets in the filename, it doesn't work:

C:\>dir > a[b

The debug messages indicate the file is being created but it never is. Likewise if you create a file outside of DOSBox:

$ touch "b[c"

Then try to access it from within DOSBox:

C:\>dir
C:\>type b[c

You can see the file is there, but you can't access it. This isn't a problem with the shell, as DOS file manipulation programs also can't access these files.

I'm not sure what the correct DOS-like behaviour is meant to be (whether it should allow square brackets or reject/escape them) but I think these characters are allowed in filenames under Windows, so the same is probably true for DOS.

Reply 1 of 5, by dvwjr

User metadata
Rank Member
Rank
Member
Malvineous wrote:

...but I think these characters are allowed in filenames under Windows, so the same is probably true for DOS.

Why would you think that?

Legal MS-DOS file-name characters:
A-Z, a-z, 0-9, $%'-@{}()~!#&
Illegal MS-DOS file-name characters:
/,;^+[]"=*?|<> and a 'space' character

dvwjr

Reply 2 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

From a DOS-prompt in Windows 95:

C:\TEMP>echo abc > a[b
Error creating file

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 3 of 5, by Malvineous

User metadata
Rank Oldbie
Rank
Oldbie
dvwjr wrote:

Why would you think that?

Well I just assumed that Windows would keep to DOS' limitations - and as this problem surfaced when I unzipped a file created on a Windows box, I assumed that if you can have square brackets in Windows filenames...

I just tried it under real DOS and you're right, you're not allowed to have square brackets in filenames - so it's a bug in DOSBox then, it isn't escaping the square brackets:

C:\>dir test
Directory of C:\TEST\.
. <DIR> 12-06-2006 21:17
.. <DIR> 12-06-2006 21:17
A[B 0 12-06-2006 21:17
1 File(s) 0 Bytes.
2 Dir(s) 110,540,800 Bytes free.

Reply 4 of 5, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

> I just tried it under real DOS and you're right, you're not allowed to have square brackets in filenames

Wrong: you can hexedit the directory entries on the disk, and dos will
happily display (almost) everything.

Still there are some additional limitations on the usable characters
in some cases, to avoid problems with files on the host-PC side.
If something prohibits running a game, please give more details.

Reply 5 of 5, by franpa

User metadata
Rank Oldbie
Rank
Oldbie

since windows nt... windows has been moving away from dos limitations.

AMD Ryzen 3700X | ASUS Crosshair Hero VIII (WiFi) | 16GB DDR4 3600MHz RAM | MSI Geforce 1070Ti 8GB | Windows 10 Pro x64.

my website