dos命令& 批处理命令小结(不断更新中)

1.拷贝当前目录下所有txt文件到一个文件

copy *.txt tgt.txt

如果是合并某几个文件到某一文件且有次序

copy file1.txt+file2.txt+file3.txt combine_file.txt

2.对.exe文件在命令行方式下或者是批处理中给参数时,code中应该从agrv[1]开始,因为.exe的名字是argv[0].

如file_process.c

//////////////////////////

main()

{

string inputfile = argv[1];

string outputfile = argv[2];

}

//////////////////////////////////////

编译链接生成file_process.exe后使用时

file_processinput.txt output.txt

3.在 对perl程序写批处理时需要加'perl',如

perl process.pl input.txt output.txt

4.注释掉一行用"rem "

不过随便在前面添点古怪的咚咚,比如sharp # ,会被认为bad command ,同样可以起到不执行的效果.

5. 文件重命名用rename

6. 删除文件用del

你可能感兴趣的:(C++,c,C#,dos,perl)