删除带有非法字符的文件或文件夹

今天恢复系统的时候发生了悲剧,原来下载的网页、起过中文文件名的文件夹等等,全都包含了非法字符。对这样的文件,windows explorer无法对其进行任何操作(读写、改名、删除等等)。查找了半天,发现在MSDN中有解决这样问题的答案。不过这个办法只适用于在win98、winMe下,因为它把带有扩展字符集编码的字符,都给解释成了下划线。在win2000以上的版本中有windows resource kit中的一个命令能把文件名中带有非法字符的文件给删除或者改名。不过我却没有找到这个叫rm.exe的程序,microsoft也在自己的网站上去掉了resource kit的下载。

下面是MSDN中的记录

RESOLUTION

You may be able to delete or rename the file or folder using one of the following methods:

  • If you want to delete a file, try to delete the file using the DEL command and "*.*" wildcard designator. Note that this method deletes all the files in the folder containing the file you want to delete, so you should move all the files you want to save to a different folder first. To do so, follow these steps:

    1. Type the following commands at an MS-DOS command prompt. Press ENTER after each command:

      cd /
      md keep

    2. Copy all the files you want to save from the folder containing the file you want to delete to the KEEP folder you created in step 1.
    3. In the directory containing the file you want to delete, type the following command at an MS-DOS command prompt and press ENTER:

      del *.*
  • For files and folders, you may be able to delete or rename the file or folder using the "?" wildcard designator to represent the extended characters in the file or folder name. For example, if the first character in the filename README.TXT were replaced by a character from the extended character set, you could use the following command to rename the file back to README.TXT:

    ren ?eadme.txt readme.txt

    NOTE: The "?" wildcard designator is used to represent any character in the wildcard designator's position. Use caution when you use this method to make sure you do not inadvertently delete or rename files other than the intended file.

  • For files or folders, you may be able to delete the file or folder using the DELTREE command. To do so, change to the affected folder and type "deltree *.*" (without quotation marks). Confirm only the files and folders you want to delete. The DELTREE command removes files and folders without regard to extended characters in their names.
  • Use a disk utility such as Norton Disk Doctor from Symantec or PC Tools from Central Point Software to rename or delete the file.

有一个简便的方法,帮助你整理变乱的文件名。那就是,把机器的既定语言和地域改成英文的,这样绝大多数不能打开的文件就能够进行操作了。如果还是不能,试试改成其他的。

 千万不要在你机器上有大量中文文件名的文件的时候,把系统恢复成其他语言的Win98、WinMe。因为他们不支持Unicode!会把你好好的文件名给改得乱七八糟!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值