I wanted keep my users from running “dir” in the command line, so I used DOSKEY to alias “Dir” to “CLS”. The testers found out that putting a space before “DIR” will circumvent the alias.
I’ve tried to put a space before “DIR” when setting up the DOSKEY, but the command prompt ignores the white space.
Anyone found a way of making DOSKEY acknowledge spaces?
Thanks.
Deny your users the List Directory contents permission on all relevant locations. That’s probably the easier way. That way they can run
dirbut it won’t be of any use.I’m not even trying to figure out why you want such a thing, though.
Regarding
doskey: As you noticed, macro substituion is done literally and only at the beginning of the command line. So what do you want to do? Create macros fordirtoclswith 1, 2, 3, …, 8188 spaces before it?