HughRyu
V2EX  ›  Windows

windows 下 cmd 关于删除根目录规律前缀的目录批处理

  •  
  •   HughRyu · Dec 6, 2018 · 4195 views
    This topic created in 2739 days ago, the information mentioned may be changed or developed.

    Windows 2008 下 D 盘根目录有规则前缀目录 Phone-1 Phone-2 Phone-4-1 Phone3369.3 类似这些都带有 Phone 前缀的目录. cmd 下 rd 或者 rmdir 都不支持通配符 比如 rmdir /s D:\Phone 这种操作是不允许的.

    请问怎么做批处理来实现批量删除?

    4 replies    2018-12-06 17:49:30 +08:00
    jjianwen68
        1
    jjianwen68  
       Dec 6, 2018
    一个方法:安装过 git 吧,git 下有 rm 命令,这个总能支持通配符了
    imn1
        2
    imn1  
       Dec 6, 2018
    powershell:
    help remove-item
    Kasine
        3
    Kasine  
       Dec 6, 2018
    也可以用批处理:
    for /d %i in (phone*) do rd %i
    Kasine
        4
    Kasine  
       Dec 6, 2018
    抱歉,是循环
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2941 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 06:43 · PVG 14:43 · LAX 23:43 · JFK 02:43
    ♥ Do have faith in what you're doing.