删除一个名为&QUOT文件; NUL"在Windows [英] Delete a file named "NUL" on Windows

查看:785
本文介绍了删除一个名为&QUOT文件; NUL"在Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑在Windows 7上这是在Cygwin下编译并通过了NUL作为一个输出文件名的程序。相反,SUP pressing输出它实际上创造了一个在当前目录下名为NUL文件。 (显然它希望的/ dev / null的,即使是在Windows)。现在我仍坚持这一NUL的文件,我不能删除!

I ran a program on Windows 7 that was compiled under Cygwin and passed "NUL" as an output file name. Instead of suppressing output it actually created a file named "NUL" in the current directory. (Apparently it expects "/dev/null", even on Windows.) Now I'm stuck with this "NUL" file that I cannot delete!

我已经尝试过:


  • Windows资源管理器 - 错误:无效的MS-DOS功能(!是的,这是严重的它说什么)

  • 使用德尔NUL命令提示符 - 错误:文件名,目录名或卷
    标签语法不正确。

  • 删除整个目录 - 同一交易只是删除文件

  • 删除()在C程序 - 也失败

  • Windows Explorer - error: "Invalid MS-DOS function" (yes, that is seriously what it says!)
  • Command prompt using "del NUL" - error: "The filename, directory name, or volume label syntax is incorrect."
  • Deleting the entire directory - same deal as just deleting the file
  • remove() in a C program - also fails

如何才能摆脱这些文件NUL(我现在几个),总之在Cygwin下安装完整的Cygwin环境和编译C程序的办呢?

How can I get rid of these NUL files (I have several by now), short of installing the full Cygwin environment and compiling a C program under Cygwin to do it?

推荐答案

打开命令提示符,然后使用这些命令,先重命名,然后删除NUL文件:

Open a command prompt and use these commands to first rename and then delete the NUL file:

C:\> rename \\.\C:\..\NUL. deletefile.txt
C:\> del deletefile.txt

使用 \\\\。\\ preFIX讲述了高层次的文件I / O函数来传递文件名未解析到设备驱动程序 - 这样你就可以访问否则无效名称。

Using the \\.\ prefix tells the high-level file I/O functions to pass the filename unparsed to the device driver - this way you can access otherwise invalid names.

文章有关有效在Windows和各种保留名称的文件/路径名。

Read this article about valid file / path names in Windows and the various reserved names.

这篇关于删除一个名为&QUOT文件; NUL"在Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆