如何有效地使用批处理脚本?
我想创建一些批处理脚本来移动一些文件。但我想知道是否有关于如何做到这一点的任何好的资源?您只使用命令行参数吗?
I would like to create some batch scripts to move some files around. But i was wondering if there are any good resources on how to do this? Do you just use Command Line arguments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在最简单的层面上,批处理脚本是一个扩展名为
.bat
的文本文件,由您在命令行中输入的相同命令组成,并用回车符分隔。因此,该文件:
是一个批处理脚本,尝试在 C: 根目录上创建目录“HelloWorld”。
批处理脚本可能要复杂得多,涉及变量和流控制逻辑,但在您走上这条路之前,您可能需要调查powershell 和 WSH。
编辑 糟糕...修复了 powershell 的链接。
At its simplest level, a batch script is a text file with a
.bat
extension, and consists of the same commands you would enter at the command line, separated by carriage returns.Thus, the file:
Is a batch script that attempts to create the directory "HelloWorld" on your C: root.
Batch scripts can be much more complex, involving variables and flow control logic, but before you travel that road, you may want to investigate powershell and WSH.
Edit Oops... fixed the link to powershell.
基本上,您只需执行命令行参数即可。但支持某些类型的变量,以及批处理文件的命令行参数,您可以使用它们。
http://www.computerhope.com/batch.htm
Basically, you just do command-line argument. But there are certain types of variables supported, and also command-line arguments to the batch file, which you can use.
http://www.computerhope.com/batch.htm