批处理删除文件夹命令

批处理文件夹命令 (Batch File Folder Commands)

1. Dir 2. Mkdir 3. Rmdir 4. Chdir 5. Ren 6. Pushd 7. Popd

1. Dir 2. Mkdir 3. Rmdir 4. Chdir 5. Ren 6. Pushed 7. Popd

指挥官 (Dir Command)

The dir command serves to print the contents in a directory. As usual like all other commands, this also has some switches that narrow down the results according to the switches used.

dir命令用于在目录中打印内容。 像所有其他命令一样,它也具有一些开关,这些开关可以根据使用的开关来缩小结果范围。

Eg: C:Usersuser1>dir

例如: C:Usersuser1> dir

Executing the dir command without any switches gives the following output.

在没有任何开关的情况下执行dir命令将产生以下输出。

Volume in drive C is OS Volume Serial Number is C484-3F97 Directory of C:Usersuser1 03/04/2014  07:40 AM    <DIR>          dwhelper 03/12/2015  05:57 PM    <DIR>          Favorites 0 File(s)              0 bytes 31 Dir(s)  137,566,859,264 bytes free

驱动器C中的 为OS 卷序列号为C484-3F97 C: Usersuser1 目录2014年 4月4日上午7:40 <DIR> dwhelper 2015年 3月 12 日05:57 PM <DIR>收藏夹 0文件0字节 31个dir 137,566,859,264字节可用

Initially it prints the drive details and then the contents in a table format. The first column gives the created date of either the file or the folder, Next column indicates the time of creation, then follows the <DIR> that indicates it is a folder. Finally the last column displays the column name. At last the number of files, directories and free memory space available on the drive is displayed.

最初,它先打印驱动器详细信息,然后以表格格式打印内容。 第一列给出了文件或文件夹的创建日期,下一列表明了创建时间,然后在<DIR>之后表明它是文件夹。 最后,最后一列显示列名。 最后显示驱动器上可用的文件,目录和可用存储空间的数量。

Flags in Dir Command dir command with ‘/a’ switch will display all the files and folders in a directory, no matter what attribute is set.

无论设置了什么属性,Dir Command dir命令中带有“ / a”开关的标志都将显示目录中的所有文件和文件夹。

‘dir /a[D|R|H|A|S|I]’ Switches description is as follows. ‘D’ to display Directories, ‘R’ to display Read-only files, ‘H’ to display Hidden files, ‘A’ to display Files ready for archiving, ‘S’ to display System files and ‘I’ to display not content indexed files.

'dir / a [D | R | H | A | S | I]'开关说明如下。 “ D”显示目录,“ R”显示只读文件,“ H”显示隐藏文件,“ A”显示准备归档的文件,“ S”显示系统文件,“ I”显示不内容索引文件。

‘dir /b’ Here ‘b’ stands for bare information. This serves similar purpose of dir command but only the folders and files are displayed in a single column without their extensions, date and time.

'dir / b'这里的'b'代表裸露的信息。 这与dir命令的目的相似,但只有文件夹和文件显示在单列中,没有扩展名,日期和时间。

‘dir /d’ command simply displaying the file names with their extensions alone.

'dir / d'命令仅显示带有扩展名的文件名。

‘dir /l’ displays the output in lowercase.

'dir / l'以小写形式显示输出。

‘dir /o’ sorts the order of files and folders.

'dir / o'排序文件和文件夹的顺序。

Mkdir命令 (Mkdir Command)

The mkdir command stands for to make a directory, which is used to create new directories in the desired location. Also the mkdir command is a replacement of the ‘md’ command. We can create any number of directories just by using a single mkdir command. This command doesn’t have any switches.

mkdir命令代表建立目录,该目录用于在所需位置创建新目录。 同样,mkdir命令代替了'md'命令。 我们只需使用一个mkdir命令就可以创建任意数量的目录。 该命令没有任何开关。

Eg: mkdir My Programs (or) Md My Programs

例如: mkdir我的程序(或)Md我的程序

The above two commands create a new directory named My Programs in the location where you are currently working. We can also create a folder inside another folder at the same time using a single command as the below one.

上面的两个命令在您当前工作的位置创建一个名为“我的程序”的新目录。 我们还可以使用下面的单个命令同时在另一个文件夹中创建一个文件夹。

Eg: md new1\new2\new3

例如: md new1 \ new2 \ new3

This command creates new1 folder then creates new2 inside new1 and at last new3 inside new2.

此命令创建new1文件夹,然后在new1内部创建new2,最后在new2内部创建new3。

Rmdir命令 (Rmdir Command)

The rmdir command is short hand for the remove directory that is used to remove an already existing directory or folder, you can use the command as ‘rd’ also which serves for the same purpose. For deleting a folder using rd command we need to make sure that it does not contain any files or sub folders.

rmdir命令是用于删除目录的快捷方式,该目录用于删除已经存在的目录或文件夹,您也可以将命令用作“ rd”,该命令也用于相同的目的。 要使用rd命令删除文件夹,我们需要确保该文件夹不包含任何文件或子文件夹。

Eg: rd new1

例如: rd new1

The above command doesn’t delete the folder new1 as already their exits a folder new2 inside new1. So, we use two switches to solve this problem. The rd command has two switches ‘/s’ and ‘/Q’. The ‘/s’ switch is used to delete all the directories, sub-directories and files inside the folder. So, you won’t have to manually delete all the sub folders and files inside them. The next switch ‘/Q’ stands for quiet mode, in quiet mode the command doesn’t prompt you for confirmation and does all the task of deleting silently.

上面的命令不会删除文件夹new1,因为它们已经退出了new1内的文件夹new2。 因此,我们使用两个开关来解决此问题。 rd命令有两个开关“ / s”和“ / Q”。 “ / s”开关用于删除文件夹中的所有目录,子目录和文件。 因此,您不必手动删除其中的所有子文件夹和文件。 下一个开关“ / Q”代表安静模式,在安静模式下,该命令不会提示您进行确认,而是执行所有删除操作。

Chdir命令 (Chdir Command)

The chdir command is used to change the current working directory. It can also be used in short as ‘cd’. The small difference between cd and chdir is that the chdir command doesn’t require the path given to be in quotes when the folder names contains spaces. But in case of cd command, it is necessary to give the path in quotes.

chdir命令用于更改当前工作目录。 它也可以简称为“ cd”。 cd和chdir之间的细微差别是,当文件夹名称包含空格时,chdir命令不需要给定的路径用引号引起来。 但是,如果使用cd命令,则必须用引号将路径引起来。

Eg: chdir  programsstart menu cd  “programsstart menu”

例如: chdirprogramsstart菜单cd“ programsstart菜单”

The above commands change the current working directory into start menu directory. Also we can use command ‘cd..’ to move one level up in the hierarchy of directories. And ‘cd’ to move into the current drive.

上面的命令将当前工作目录更改为开始菜单目录。 我们还可以使用命令“ cd ..”在目录层次结构中上移一级。 和“ cd”移动到当前驱动器。

任统帅 (Ren Command)

Rename command ‘ren’ is used to rename a directory on windows through the dos shell. ren can be replaced with its longer version as ‘rename’. The following example shows the syntax for renaming a folder.

重命名命令“ ren”用于通过dos外壳在Windows上重命名目录。 可以用较长版本的“重命名”代替ren。 以下示例显示了重命名文件夹的语法。

Eg: rename programmer crazyprogrammer

例如:将程序员重命名为crazyprogrammer

The above command renames the directory ‘programmer’ to ‘crazyprogrammer’. This command doesn’t have any switches.

上面的命令将目录“ programmer”重命名为“ crazyprogrammer”。 该命令没有任何开关。

推入和弹出命令 (Pushd and Popd Commands)

The pushd command is used to push the working directory or any specified directory. The current working directory is pushed into the stack and remains there until it is popped out. The popd command is used to pop out a directory that is pushed using the pushd command. Let us consider the below command to understand in detail.

pushd命令用于推送工作目录或任何指定目录。 当前的工作目录被推入堆栈,并保持在那里直到弹出。 popd命令用于弹出使用pushd命令推送的目录。 让我们考虑下面的命令来详细了解。

Eg: Assume that I’m in ‘C:myfolder’ and I want to push directly to ‘C:windows’. I can do so using the following command

例如:假设我在'C:myfolder'中,并且我想直接推送到'C:windows'。 我可以使用以下命令进行操作

Pushd C:windows

推入C:windows

Then my current working directory changes to ‘C:windows’ and the path ‘C:myfolder’ gets pushed into the stack. Next when I execute a popd command, my working directory changes to ‘C:myfolder’ as it pops out from the stack.

然后,我当前的工作目录更改为“ C:windows”,路径“ C:myfolder”被压入堆栈。 接下来,当我执行popd命令时,我的工作目录会从堆栈中弹出,更改为“ C:myfolder”。

C:windows> popd C:myfolder>

C:windows>弹出C:myfolder>

Try it yourself Create a directory and apply all the commands over it, observe and note down the results.

自己尝试创建目录并在其上应用所有命令,观察并记录结果。

翻译自: https://www.thecrazyprogrammer.com/2015/07/batch-file-folder-commands.html

批处理删除文件夹命令

批处理删除文件夹命令_批处理文件夹命令相关推荐

  1. windows下批处理删除文件夹、删除文件、if exist用法

    windows下批处理删除文件夹.删除文件.if exist用法 开发中用到Window批处理del.rd.if exist,总结用法便于后续使用. windows下批处理删除文件: * 使用del指 ...

  2. linux批处理定时删除文件,forfiles命令,在Windows删除旧文件-批处理删除文件

    在运行Windows的时候,也会出现一些不必要的文件,需要进行定期的删除,避免占用大量的磁盘空间.Windows的forfiles命令犹如Linux的find命令,一行命令就可以删除旧文件及文件夹. ...

  3. win7系统定时删除数据的批处理命令_win7系统使用批处理删除文件详细教程

    批处理文件是扩展名为·bat 或·cmd的文本文件,包含一条或多条命令,由dos或windows系统内嵌的命令解释器来解释运行.很多win7用户为了提高效率也为了提高运行速度,常常使用批处理删除不需要 ...

  4. win7系统定时删除数据的批处理命令_Win7系统怎么批处理删除文件

    平常使用电脑过程中,我们可以使用批处理命令,轻松删除文件.批处理文件是扩展名为·bat 或·cmd的文本文件,包含一条或多条命令,由DOS或Windows系统内嵌的命令解释器来解释运行.接下来,我们就 ...

  5. win7系统定时删除数据的批处理命令_Win7系统批处理删除文件的方法

    平常使用电脑过程中,我们可以使用批处理命令,轻松删除文件.批处理文件是扩展名为·bat 或·cmd的文本文件,包含一条或多条命令,由DOS或Windows系统内嵌的命令解释器来解释运行.接下来,我们就 ...

  6. windows下批处理删除文件及注册表项

    1.windows下批处理删除注册表项 假如我要清除WinRAR的历史记录,可以新建个批处理文件, 然后在里面加入如下文字: reg delete HKEY_CURRENT_USER/Software ...

  7. cmd bat删除文件命令_运用sed命令高效地删除文件的特定行

    运用 sed 命令高效地删除文件的特定行 正常来说,我们想要删除文件中的某些行内容,一般都是先打开这个文件,然后找到要删除的内容,再然后选中这些行并按删除键进行删除,这在数据量很少时是没有问题的.但是 ...

  8. bat批处理删除文件

    最近接触到了一些有意思的技术,比如chrome插件,批处理脚本.以前都只会用,现在想着有机会能做一个. 刚好最近在做一个功能,导入文件,上传过程中要校验数据,如果失败的话可以下载错误报告到本地.不过错 ...

  9. windows自动化批处理删除文件

    前言 最近发现某软件删除某几个文件夹之后,就可以再次免费试用,但试用期结束之后需要再次重复删除.于是想到了批处理命令,大家可以创建txt文件,然后编辑命令后将文件后缀改成bat,然后双击运行即可完成批 ...

  10. forfiles 批处理删除文件

    1. 用批处理文件删除当前目录下 7 天以前的扩展名为bkf文件(以当前系统时间为基准)    示例: forfiles /m *.bkf /d -7 /c "cmd /c del @fil ...

最新文章

  1. Shiro-授权(RBAC)
  2. ajax div 赋值重新渲染_30分钟全面解析图解AJAX原理
  3. tf.layers.dropout
  4. 怎么判断到了月初_双春年与无春年怎么区分?2021年是寡妇年吗?
  5. 国家和货币(符号/图片)数组(countries and currency symbol array)
  6. 【Alpha】第九次Scrum meeting
  7. 印象笔记的插件在chrome使用问题
  8. 酒店预订管理小系统c语言,酒店管理系统有些问题,求c语言大佬帮忙
  9. 介质天线的设计原理_详解rifd标签天线的设计原理和测量技巧
  10. win7自带截图工具怎样给菜单截图
  11. 如何保护自己的颈椎?
  12. 正弦稳态电路的阻抗和功率
  13. 方阵求值——上三角行列式、定义(康拓展开求值)
  14. 计算机无法调节亮度,win10屏幕亮度没反应如何处理_win10电脑屏幕亮度调不了怎么办...
  15. 6 月份最火的 10 个 GitHub 项目
  16. Spring MVC 地址请求映射
  17. linux 安装qt5和qtcreator开发工具
  18. ES应用场景及核心概念一
  19. Android基于高德SDK的开发——自定义地图主题样式(悬浮按钮+底部弹窗)
  20. [android开发必备]Android开发者社区汇总

热门文章

  1. CSS样式(内联、内部、外部)
  2. python爬虫--下载酷我音乐
  3. Js 生成uuid的四种方法
  4. js实现签名功能(vue中使用电子签名)
  5. 一次完整的http请求过程
  6. Spring动态代理的两种方式
  7. java线程栈日志_Java线程堆栈
  8. 学校机房环境监控系统解决方案!
  9. Nuxt.js mini聊天室代码
  10. PCB LAYOUT 设计民睿科技有限公司承接PCBLAYOUT项目