Post

【小技巧】利用bat批量新建文件

一个很简单的小应用,应用场景是我要新建全国各省份的excel文件,并且想要有设定的内容时,用到的一个批处理。

先新建一个1.txt文件,输入以下内容,再另存为1.bat文件。

@echo object_id	post_title	guid>>6_贵州.xls
@echo object_id	post_title	guid>>7_湖南.xls
@echo object_id	post_title	guid>>8_江西.xls
@echo object_id	post_title	guid>>9_浙江.xls
@echo object_id	post_title	guid>>10_四川.xls
@echo object_id	post_title	guid>>11_重庆.xls
@echo object_id	post_title	guid>>12_湖北.xls
@echo object_id	post_title	guid>>13_安徽.xls
@echo object_id	post_title	guid>>14_江苏.xls
@echo object_id	post_title	guid>>15_上海.xls
@echo object_id	post_title	guid>>16_西藏.xls
@echo object_id	post_title	guid>>17_青海.xls
@echo object_id	post_title	guid>>18_甘肃.xls
@echo object_id	post_title	guid>>19_陕西.xls
@echo object_id	post_title	guid>>20_河南.xls
@echo object_id	post_title	guid>>21_山东.xls
@echo object_id	post_title	guid>>22_宁夏.xls
@echo object_id	post_title	guid>>23_山西.xls
@echo object_id	post_title	guid>>24_河北.xls
@echo object_id	post_title	guid>>25_天津.xls
@echo object_id	post_title	guid>>26_北京.xls
@echo object_id	post_title	guid>>27_辽宁.xls
@echo object_id	post_title	guid>>28_吉林.xls
@echo object_id	post_title	guid>>29_黑龙江.xls
@echo object_id	post_title	guid>>30_内蒙古.xls
@echo object_id	post_title	guid>>31_新疆.xls

新建的excel文件
20150710171259

excel文件里面创建的字符
20150710171609

 

Leave a Reply