penpen wrote: ↑21 Nov 2018 18:29
Are you sure it's not the "short name"-issue - what does "dir/x" say?
penpen
I create a folder named "test". inside i create 2 control files "a.cmd" and "ba.CMD" and some false positives not just any name, only some names pop up for some reason so in my case "getFullPathFile_.cmd" and "$filetouch.cmd"
tst.cmd contains
Code: Select all
@echo off
dir/X/S/A-D "*a.CMD"
for /R %%? in ("*a.CMD") do echo.forR=%%?_
pause
exit /b
I move the folder to desktop and run test.cmd which gives
Code: Select all
De volumenaam van station E is home
Het volumenummer is 65C7-ABF4
Map van E:\ADMIN\VIP\MSENV\Bureaublad\test
12/11/2018 15:59 0 a.cmd
12/11/2018 15:59 0 ba.cmd
2 bestand(en) 0 bytes
Totaal aantal weergegeven bestanden:
2 bestand(en) 0 bytes
0 map(pen) 6.990.938.112 bytes beschikbaar
forR=E:\ADMIN\VIP\MSENV\Bureaublad\test\a.cmd_
forR=E:\ADMIN\VIP\MSENV\Bureaublad\test\ba.cmd_
Druk op een toets om door te gaan. . .
I move the folder to Plextor NAS and run test.cmd which gives
Code: Select all
De volumenaam van station T is ED-XTRA-0
Het volumenummer is 55B8-8500
Map van T:\test
12/11/2018 15:59 0 a.cmd
12/11/2018 15:59 0 ba.cmd
2 bestand(en) 0 bytes
Totaal aantal weergegeven bestanden:
2 bestand(en) 0 bytes
0 map(pen) 326.354.075.648 bytes beschikbaar
forR=T:\test\a.cmd_
forR=T:\test\ba.cmd_
Druk op een toets om door te gaan. . .
I move the folder to ZyXEL NAS and run test.cmd which gives
Code: Select all
De volumenaam van station W is ed-serv-0
Het volumenummer is 3091-3091
Map van W:\test
12/11/2018 15:59 0 ba.cmd
12/11/2018 16:01 0 G7B7HF~A.CMD getFullPathFile_.CMD
12/11/2018 15:59 0 a.cmd
13/11/2018 02:15 0 $KLZMG~A.CMD $fileTouch.CMD
4 bestand(en) 0 bytes
Totaal aantal weergegeven bestanden:
4 bestand(en) 0 bytes
0 map(pen) 776.869.900.288 bytes beschikbaar
forR=W:\test\ba.cmd_
forR=W:\test\getFullPathFile_.CMD_
forR=W:\test\a.cmd_
forR=W:\test\$fileTouch.CMD_
Druk op een toets om door te gaan. . .
G7B7HF~A.CMD getFullPathFile_.CMD
G7B7HF~A.CMD appears to be the shortname for getFullPathFile_.CMD.
You hit the culprit penpen
When reading the comment at the /X switch one sentence is striking:
/X ... short names that are not available are displayed as spaces...
but this isn't DOS why would I need 8.3 filename support at all ? But more importantly how do i disable or suppress them ?
I just learned short names are a huge security risk, especially if you run server side software like Apache or IIS.
https://www.acunetix.com/blog/articles/ ... y-problem/
It talks about disables 8.3 file name support using the registry. But my scripts are to be run on other peoples machines.
And messing with other peoples machine settings is out of the question.
The /N switch doesn't do anything, it just hides the short names but still displays them in the query. And what switch would I use when I issue a for command ?
This is not just bad news for me but for anyone supporting 8.3 which is most people. This means DIR and FOR are unreliable per definition if not careful thought is being put into this