Board logo

标题: [求助]如何在批处理使用 xxx..\ 这样的路径 [打印本页]

作者: consatan     时间: 2009-6-29 03:09    标题: [求助]如何在批处理使用 xxx..\ 这样的路径
想要在各个分区建立如
D:\autorun.inf\nodel..\
这种类型的文件夹
通过

for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do del /a /f /q %%a:\autorun.inf>nul 2>nul & md %%a:\autorun.inf >nul 2>nul & %%a: >nul 2>nul & cd %%a:\autorun.inf >nul 2>nul & md nodel..\ >nul 2>nul & attrib +s +h +r %%a:\autorun.inf>nul 2>nul

这样的批处理可以建立
但想把他弄成一句


md D:\autorun.inf\nodel..\

建立的却是普通的文件夹

如果我想使用
subst 命令将 D:\autorun.inf\nodel..\
这个目录指派到虚拟的分区
那该怎么写??

@ECHO OFF
md D:\autorun.inf >nul 2>nul & D: >nul 2>nul & cd D:\autorun.inf >nul 2>nul & md nodel..\ >nul 2>nul & attrib +s +h +r D:\autorun.inf>nul 2>nul
IF EXIST X:\NUL GOTO DELETE
SUBST X: "D:\autorun.inf\nodel..\"
START X:\
GOTO END
:DELETE
SUBST /D X:
:END


这样的话会提示找不到路径...

作者: Hanyeguxing     时间: 2009-6-29 03:52
对于md D:\autorun.inf\nodel..\创建了普通文件夹

要先md D:\autorun.inf\,然后再md D:\autorun.inf\nodel..\

即:

md D:\autorun.inf\
md D:\autorun.inf\nodel..\

就可以

SUBST 无法像你的批处理那样直接使用这样指定的路径
例如:
D:\autorun.inf
D:\autorun.inf\
D:\nodel..
D:\nodel..\

Last edited by Hanyeguxing on 2009-6-29 at 04:35 ]

作者: consatan     时间: 2009-6-29 05:11
Originally posted by Hanyeguxing at 2009-6-29 03:52 AM:
对于md D:\autorun.inf\nodel..\创建了普通文件夹

要先md D:\autorun.inf\,然后再md D:\autorun.inf\nodel..\

即:

md D:\autorun.inf\
md D:\autorun.inf\nodel..\
...

如果可以就好了...
依然感谢你的回复<img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">

作者: tireless     时间: 2009-6-29 06:59
md "\\?\D:\autorun.inf\nodel..\"


——————————————————————————————————————
建议用设置注册表权限的方法来禁止自动播放:

Disable the autorun.inf forever

Last edited by tireless on 2009-6-29 at 07:03 ]

作者: consatan     时间: 2009-6-29 11:52
Originally posted by tireless at 2009-6-29 06:59 AM:
md "\\?\D:\autorun.inf\nodel..\"


——————————————————————————————————————
建议用设置注册表 ...

<img src="images/smilies/face-grin.png" align="absmiddle" border="0">这是为什么??
为什么使用 "\\?\D:\autorun.inf\nodel..\" 这个路径就可以??

不过...subst命令依然不行...
还有...我不是要禁止自动运行啦...
我是想说建立一个隐藏的文件夹,用来存“不想让人看”的文件...

作者: tireless     时间: 2009-6-29 12:53
SUBST X: "\\?\D:\autorun.inf\nodel."

作者: consatan     时间: 2009-6-29 13:31
Originally posted by tireless at 2009-6-29 12:53 PM:
SUBST X: "\\?\D:\autorun.inf\nodel."

<img src="images/smilies/face-sad.png" align="absmiddle" border="0">虽然说的确能subst上去了...
但却没办法直接双击打开...
被识别为“其他”带红色问号的分区...
用start X:也不行...
晕...