1

I have a file named con.php. I tried to remove it through the Windows command line but it returns an error:

Syntax for filename, directory name, or volume label is incorrect.
phuclv
  • 27,773
sNniffer
  • 111

1 Answers1

9

Assuming the full path is c:\foo\bar\con.php, then

del \\?\c:\foo\bar\con.php

Due to ancient MS-DOS "compatibility" concerns, con is the console, yes even with an extension. This is in a layer above the file system.

The \\?\ prefix suspends DOS-compatible parsing and hands the rest of the spec directly to the file system.

Link to explanation: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#win32-file-namespaces

dave
  • 126