Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Completely by accident, I created a file named ... using Grunt.js for Node in Windows 8.

Is it possible to remove this file without having to reformat the partition?

share|improve this question
3  
Yes, it is. It can probably be done with Explorer (it has been a long time since I have seen an unlocked file Explorer can't delete). Failing that, cmd.exe should be able to handle it okay - see delete. If both of those fail, grab mingw or cygwin and delete it. But, not programming related ... –  user2246674 Apr 30 '13 at 6:39
1  
What did you try to remove it and what failed? –  Jan Doggen Apr 30 '13 at 8:57
    
Loss of similar questions, such as superuser.com/questions/282194, superuser.com/questions/554072 etc. Also see support.microsoft.com/kb/320081. –  Karan Apr 30 '13 at 15:07
    
@Karan but are those similar questions really relevant here? 282194 is about a reserved word and 554072 is about a Linux issue, surely here the problem is an invalid name? Cause 6 of kb/320081 seems relevant (but I still think there is a better solution!) –  pnuts Apr 30 '13 at 16:03
    
@pnuts: None of the linked questions is about a Linux issue. Basically all questions of this type are similar IMO. The problem is that the GUI restricts the filenames/characters that can be used, but the underlying file system itself doesn't. Thus when you somehow end up with 'invalid' filenames you're stuck unless you use the alternate syntax that bypasses the normal checks, or use another OS such as Linux. (P.S. In my comment above obviously Loss = Lots.) –  Karan Apr 30 '13 at 16:33
show 2 more comments

migrated from stackoverflow.com Apr 30 '13 at 7:51

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 4 down vote accepted

Run cmd.exe and type del \\?\absolutepath. So if the filename is C:\tmp\... then type del \\?\C:\tmp\....

Giving the \\?\ prefix makes the program use the Unicode version of the Windows file functions. These can handle more filenames than the ANSI versions. The Unicode version for example allows you to create or delete files named CON, PRN or NUL which are old filenames which still have special meaning in Windows.

share|improve this answer
    
Did it for me! Thanks :D. –  Saturn2888 May 1 '13 at 3:10
add comment

in addition to user2246674 and pnuts answer, I recommend you get "Unlocker" for Windows . It's a nifty little gadget - easy to download, install and use. All of my machines run it. If you have installed it onto your machine in Windows, simply right click the file and then choose "Unlocker" from the menu and then select "Delete" in the left menu options and click on OK.

This tool is quite useful even if something is writing to the file and has accessed it. It will UNLOCK it and you can delete it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.