入门命令11-移动文件(夹):move

move的意思不解释了  它可以用来移动文件(夹)或者对移动文件(夹)时重命名.

 1 C:\DOCUME~1\DOUPI>move /?
2 Moves files and renames files and directories.
3
4 To move one or more files:
5 MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
6
7 To rename a directory:
8 MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
9
10 [drive:][path]filename1 Specifies the location and name of the file
11 or files you want to move.
12 destination Specifies the new location of the file. Destination
13 can consist of a drive letter and colon, a
14 directory name, or a combination. If you are moving
15 only one file, you can also include a filename if
16 you want to rename the file when you move it.
17 [drive:][path]dirname1 Specifies the directory you want to rename.
18 dirname2 Specifies the new name of the directory.

用这个命令有几个注意点,来看几个例子.

1. 基本移动文件(夹),在win平台,但它不能跨驱动器移动文件夹.

 1 E:\>md aa bb\bbb cc
2 E:\>copy con aa\test1.txt
3 this is test11111^Z
4 已复制 1 个文件。
5
6 rem 移动文件到文件夹
7 E:\>move aa\test1.txt cc\
8 rem 移动一个文件夹到另一文件夹,带了\,,,移动失败!??
9 E:\>move bb\ cc\
10 系统找不到指定的文件。
11 rem 再来一次,成功
12 E:\>move bb cc\
13
14 rem 跨驱动器移动文件,成功.
15 E:\>move cc\test1.txt d:\
16 E:\>dir d:\test1.txt
17 驱动器 D 中的卷是 SOFT
18 卷的序列号是 6C97-9E44
19 d:\ 的目录
20 2011-12-12 10:49 17 test1.txt
21 1 个文件 17 字节
22 0 个目录 133,784,256,512 可用字节
23 rem 跨驱动器移动文件夹,失败
24 E:\>move cc\bb d:\
25 拒绝访问。

2.重命名功能

 1 rem 移动文件时进行重命名
2 E:\>move d:\test1.txt e:\cc\test2.txt
3
4 rem 如果第二参数为已存在的文件夹,则是移动操作
5 E:\>move aa cc
6 E:\>cd cc
7 E:\cc>dir
8 驱动器 E 中的卷是 TEST
9 卷的序列号是 EC10-1C79
10 E:\cc 的目录
11 2011-12-12 10:59 <DIR> .
12 2011-12-12 10:59 <DIR> ..
13 2011-12-12 10:50 <DIR> aa
14 2011-12-12 10:49 <DIR> bb
15 2011-12-12 10:49 17 test2.txt
16 1 个文件 17 字节
17 4 个目录 131,208,916,992 可用字节
18 rem 当第二参数为不存在的文件夹,刚是重命名文件夹操作
19 E:\cc>move bb cc
20 移动了 1 个文件。

3.其他注意

 1 E:\cc>copy test2.txt aa\
2 已复制 1 个文件。
3 rem 移动文件时覆盖会自动提示
4 E:\cc>move test2.txt aa\
5 改写 E:\cc\aa\test2.txt 吗? (Yes/No/All): y
6
7 E:\cc>copy aa\test2.txt .
8 已复制 1 个文件。
9 rem /y参数即可去掉覆盖提示,这个与其他命令是一样的. cmd中默认为-y,bat中默认为y,这点要注意
10 E:\cc>move /y aa\test2.txt .
11
12 rem 对具有隐藏属性的文件(夹)无法操作
13 E:\cc>attrib +h test2.txt
14 E:\cc>move test2.txt test1.txt
15 系统找不到指定的文件。

 

OK,此篇完结.



 



转载于:https://www.cnblogs.com/doupip/archive/2011/12/12/2284550.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值