Fixed Cannot use extended path to delete invalid file

May 30, 2008
80
0
Gerakas, Greece
I have a file on my desktop named "AUX.TXT". According to the MSDN documentation, I should be able to delete that file with the following command:

DEL \\?\C:\Users\GSchizas\Desktop\AUX.TXT

Indeed, that's what happens with Windows Command Processor (cmd.exe).

C:\Users\GSchizas\Desktop>del \\?\C:\Users\GSchizas\Desktop\AUX.TXT

(no output, it's cmd.exe we're talking about)

This also works (undocumented behavior maybe? \\.\ is supposed to be used to directly access devices)

C:\Users\GSchizas\Desktop>del \\.\C:\Users\GSchizas\Desktop\AUX.TXT

In Take Command Console 17, the following works:

C:\Users\GSchizas\Desktop>del \\.\C:\Users\GSchizas\Desktop\AUX.TXT
Deleting \\.\C:\Users\GSchizas\Desktop\AUX.TXT
1 file deleted


Although the documented behavior doesn't:

C:\Users\GSchizas\Desktop>del \\?\C:\Users\GSchizas\Desktop\AUX.TXT
TCC: (Sys) The system cannot find the file specified.
"C:\Users\GSchizas\Desktop\AUX.TXT"
0 files deleted


In Take Command Console 18, both behaviors fail, the documented one:

C:\Users\GSchizas\Desktop>del \\?\C:\Users\GSchizas\Desktop\AUX.TXT
TCC: (Sys) The system cannot find the file specified.
"C:\Users\GSchizas\Desktop\AUX.TXT"
0 files deleted


And the undocumented one (it fails more spectacularly, but it's probably a more consistent fail):

C:\Users\GSchizas\Desktop>del \\.\C:\Users\GSchizas\Desktop\AUX.TXT
TCC: (Sys) The system cannot find the file specified.
"C:\C"
0 files deleted


I can delete the file by using cmd /c del %@quote[\\?\%@full[AUX.TXT]], but TCC should not have to call cmd.exe to perform something as essential as resolving a path.

(This doesn't only apply to invalid filenames, it also applies to very long filenames, filenames with control characters in them etc., filenames written by bad-behaving applications etc.)
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
The \\.\\xxx syntax is wrong (in CMD or TCC) - it means to use the device namespace. (There is a long-standing bug in Windows where this *may* work, but it's still wrong and should be avoided for files.)

I cannot create an "AUX.TXT" file to test -- how did you generate it?
 
May 30, 2008
80
0
Gerakas, Greece
I know the \\.\xxx usage it's wrong. It's supposed to only be used to open \\.\C: or \\.\PhysicalDrive1 or stuff like that. I'm not expecting it to work in any TCC, it's just that since the proper \\?\ format didn't work, \\.\ was a good replacement.

Anyway, to make an invalid AUX.TXT on your desktop, just type this:

cmd /c copy nul: \\?\%USERPROFILE%\Desktop\AUX.TXT

You won't be able to delete it, rename it, or do anything with it with the standard shell (so you need to delete it with the command I have in my previous comment).
 
Similar threads
Thread starter Title Forum Replies Date
fishman@panix.com HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
samintz WAD Cannot unset .py[co] Support 2
Peter Murschall TEE cannot handle Unicode output Support 2
L Cannot get DEBUGMONITOR to work Support 5
Jay Sage Cannot Postion Cursor in Command Line Using Mouse Support 7
Joe Caverly A new guard page for the stack cannot be created Support 6
O I cannot use links to .btm files Support 5
E Cannot paste dollar sign into TCC on Windows 10 1803 Support 7
N Cannot install Support 2
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
thorntonpg F1 on command line The webpage cannot be found Support 5
M Fixed Cannot use the "Browse..." function in "Find files/text" dialogbox Support 2
S WAD Cannot access mapped drive in 64b Win7 Support 15
S WAD Messages cannot be seen or accessed in Forum Support 12
D cannot get into ftp://jpsoft.com/oldver Support 1
T signaling firstcondition and cannot change colors Support 8
L File association: System cannot find the associated program Support 30
Q TCC: (Sys) The process cannot access the file because it is being used by another process. Support 0
L Thanks from larryalk was Cannot apply Start in folder for Tcmd Support 11
L Cannot apply Start In folder for Tcmd Support 15
C Cannot register v12.10 without Internet access Support 19
BobK Error from START cmd, "cannot find the file" Support 16
newbie Cannot make a btm/tcc.exe window wider Support 4
P Cannot download any of Vince Fatica's plugins Support 4
Roedy Cannot have both v10 and v11 Support 7
A Cannot permanently remove Tabs toolbar using View menu - bug? Support 8
M TCC cannot find the path specified Support 4
mscheuner TCMD 8 - cannot register on Vista x64 Support 0
vefatica Disable extended directory searches (completely)? Support 8
vefatica Extended directory searches? Support 6
G Extended directory search not working Support 4
C See if a file name matches extended range. Support 15
fishman@panix.com Extended Directory Searches are not working for me in CDD Support 9
M Problem with Extended Search and non-ASCII characters in directories names Support 3
J Extended directory search has stopped working Support 9
J Extended directory search - cure by renaming tcmd.ini Support 10
S Problem with extended wildcards Support 1
J Initialise; Alias; Extended directory search Support 2
Y TCDIALOG extended Support 1
J Extended directory search - spaces in names Support 5
C extended DIR syntax? Support 7
J Extended support Support 0
rconn Extended Support keys sent Support 0
V Set path permanently from within TCC? Support 3
Jay Sage Command Will Not Run Using Short Name of Path Support 5
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D How to? Path problems in TCC20 Support 1

Similar threads