cmd 中执行多个命令?
我想使用 attrib
但它在第一个文件夹之后停止。 我有这个...
@ech off
attrib z:\test +s +h
attrib C:\Documents and Settings\Administrator\Desktop\test +s +h
是的,我有两个驱动器。但它会在第一个文件夹之后停止执行。我如何让它执行这两个命令。我知道 call 命令,但这是唯一的方法吗? DOS 不可能有这么大的缺陷,你不能在一个批处理文件中执行多个命令。
I want to hide multiple files with the attrib <file path> +s +h
but it stops after the first folder.
I have this...
@ech off
attrib z:\test +s +h
attrib C:\Documents and Settings\Administrator\Desktop\test +s +h
Yes, I have two drives. But it stops execution after the first folder. How do I make it execute both commands. I know about the call command, but is that the only way? There can't be this big of a flaw in DOS, where you can't execute multiple commands in one batch file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你没有犯错误的话(在 DOS 中,开关位于文件夹之前),它应该可以正常工作。试试这个:
同样,你的问题是你正在执行“attrib [文件夹] [属性开关]”,而 attrib.exe 需要“attrib [属性开关] [文件夹]”。感谢 JimG以便更正。这个问题可能与我的第二个 REM 语句有关,该语句涉及路径周围缺少双引号和空格。有关 attrib.exe 的详细信息,请在命令提示符下键入:
It should work fine if you haven't made a mistake (which you have - in DOS, the switches come before the folder). Try this:
Again, your problem is you're doing "attrib [folder] [attribute switches]", where attrib.exe wants "attrib [attribute switches] [folder]" instead.Thanks to JimG for the correction. The problem is probably related to my second REM statement about the missing double-quotes around the path with spaces.For more info about attrib.exe, type this at a command prompt:
你缺少 /S 标志
you are missing the /S flag
您的第二个命令不起作用,因为您没有引用其中包含空格的路径。或者,或者您的路径上在 attrib.exe 之前有一个名为 attrib.bat 的批处理文件(但我怀疑是这种情况)。您可以使用 attrib.exe 而不仅仅是 attrib 来测试它。
CALL 仅在运行其他批处理文件时才需要,而不是 .exe 文件。
Your second command doesn't work because you haven't quoted the path with spaces in it. Either that, or you have a batch file called attrib.bat on your path before attrib.exe (but I doubt this is the case). You could test it by using attrib.exe instead of just attrib.
CALL is only necessary for running other batch files, not .exe files.