3 ms·
echo "cough" > \\?\C:\temp\COM edit: meant CON not COM
by jborean93 6y ago
echo "cough" > \\?\C:\temp\COM
edit: meant CON not COM
- ardy42 6y ago>> eg. it’s still basically impossible to name a file CON on Windows 10 because of backwards compatibility. > echo "cough" > \\?\C:\temp\COM I think he's referring to CON not COM: https://en.wikipedia.org/wiki/DOS#Reserved_device_names https://en.wikipedia.org/wiki/DOS#Reserved_device_names > There are reserved device names in DOS that cannot be used as filenames regardless of extension as they are occupied by built-in character devices.... > The reserved names are: > CON, for console
- boogies 6y agoYes, I mistakenly had COM in the original comment, before editing it a while ago but maybe before jborean93’s last refresh before commenting.
- jborean93 6y agoThat's my bad (I thought it looked weird when I typed it). Still the same syntax works with CON and any other reserved DOS devices echo "hey DOS" > \\?\C:\temp\CON del \\?\C:\temp\CON While it can be "trivially" done, it's a hit or miss if any application actually supports it. You effectively need to deal with the NT path prefix \\?\ when dealing with the Win32 APIs to be able to open a handle to the file. The prefix essentially tells Win32 to back off and get the handle directly from the NT object manager.