Board logo

标题: [求助]文件夹自动改名(难题)[已结] [打印本页]

作者: liu3157551     时间: 2008-4-21 09:50    标题: [求助]文件夹自动改名(难题)[已结]
两个文件夹,A和B只能有一个出现为改名后的C
1.当A为C文件夹名时(找不到A时,只存在C和B),则改当前的C为A,改B为C

2.当B为C文件夹名时(找不到B时,只存在C和A),则改当前的C为B,改A为C

怎么使用批处理自动完成这个选择并改名呀???

下面是5楼写的,经测试已经完成了,非常感谢`~~

if exist b\nul if exist c\nul ren c a&& ren b c&&goto :eof
if exist a\nul if exist c\nul ren c b&& ren a c


Last edited by liu3157551 on 2008-4-21 at 06:37 PM ]

作者: liu3157551     时间: 2008-4-21 10:06
传说中的沙发自己坐了^_^
(怎么沙发没人坐,我坐也会被扣分的。。。早知道不坐了。。。)

Last edited by liu3157551 on 2008-4-22 at 12:20 AM ]

作者: abcd     时间: 2008-4-21 11:23
if exist b\nul if exist c\nul ....
if exist a\nul if exist c\nul ....

作者: liu3157551     时间: 2008-4-21 15:55
3楼的不知道是什么意思呀,,,,只明白一点就是如果找不到B。我就只读懂了这一句。。。。
希望会的帮帮我吧,指点一下迷津。<img src="images/smilies/face-laugh.png" align="absmiddle" border="0">

Last edited by liu3157551 on 2008-4-21 at 04:05 PM ]

作者: abcd     时间: 2008-4-21 16:39
if exist b\nul if exist c\nul ren c a&& ren b c&&goto :eof
if exist a\nul if exist c\nul ren c b&& ren a c

作者: liu3157551     时间: 2008-4-21 18:34
首先要在这里谢谢你解决了我一个大难题呀,减少了我的手工劳作。我以为在批处理可以这样使用

if exist bbbb\nul if exist cccc\nul ren cccc aaaa&& ren bbbb cccc&&goto :eof
if exist aaaa\nul if exist cccc\nul ren cccc bbbb&& ren aaaa cccc&&goto :eof
if exist dddd\nul if exist eeee\nul ren eeee ffff&& ren dddd eeee&&goto :eof
if exist ffff\nul if exist eeee\nul ren eeee dddd&& ren ffff eeee
但是用了之后发现第一个可以成功,但d,e,f不成功,这又是为什么呢???如果我想叠加的话该怎么改呀???又得打扰大家一次了。

Last edited by liu3157551 on 2008-4-22 at 12:33 AM ]

作者: liu3157551     时间: 2008-4-22 18:55
if exist WTFcc\nul if exist WTF\nul ren WTF WTFyy&& ren WTFcc WTF&&goto :next
if exist WTFyy\nul if exist WTF\nul ren WTF WTFcc&& ren WTFyy WTF
:next
if exist Interfacecc\nul if exist Interface\nul ren Interface Interfaceyy&& ren Interfacecc Interface&&goto :next1
if exist Interfaceyy\nul if exist Interface\nul ren Interface Interfacecc&& ren Interfaceyy Interface
:next1

修正后的。

Last edited by liu3157551 on 2008-4-22 at 11:55 PM ]