0

Let's say I have managed to create a file named '*' (via MSYS or whatever)

Is there a way to properly escape this such that I can call ICACLS and only list that single file?

icacls * lists everything in the directory

The file itself shows up as



and apparently entering icacls  works, but I can't really see a way of reliably escaping this character given arbitrary input. Surely there's a better solution than just replacing * with ?

LordAro
  • 111
  • 1
  • 5
  • FYI, the `` character (Unicode `U+F02A`, UTF-8 `0xEF,0x80,0xAA`) belongs to Unicode _Private Use_ area… – JosefZ Oct 22 '20 at 16:18

1 Answers1

0

Surely there's no solution in pure cmd.

  1. * (asterisk) is one of illegal characters in names for files and directories in windows, regardless of the file system:

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

The following reserved characters:

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
  1. In a few commands, you can use wildcard characters (* or ?), to represent one or more characters of a file name. However, it's not a regex-like, you can't escape them…
JosefZ
  • 1,564
  • 1
  • 10
  • 18