批量提取xx.c xx.h文件并加写成#include ”xx.c“ ,#include "xx.h"格式 / 替换文件名中的字符串 / 文件名添加前缀

批量提取xx.c xx.h文件并加写成#include ”xx.c“ ,#include "xx.h"格式 / 替换文件名中的字符串 / 文件名添加前缀

1.批量提取xx.c xx.h文件并加写成#include ”xx.c“ ,#include "xx.h"格式

新建”提取源文件.txt“,重命名为”提取源文件.bat“,以记事本打开,写入如下代码,并保存,把”提取源文件.bat“放到需要提取的目录下,双击运行即可。

@echo off
echo "提取xx.c文件..."
for /f "delims=" %%f in ('dir/b/s/a-d *.c') do (if not "%%~nxf"=="%0" echo #include "%%~nxf")
echo "提取xx.c文件完毕!!!"
echo "提取xx.h文件..."
for /f "delims=" %%f in ('dir/b/s/a-d *.h') do (if not "%%~nxf"=="%0" echo #include "%%~nxf")
echo "提取xx.h文件完毕!!!"
pause

2.替换文件名中的字符串

@echo off
echo.&set /p strtemp1= str_before:
echo.&set /p strtemp2= str_after:
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /a /b *.*') do (
set nobird=%%a
ren "%%~a" "!nobird:%strtemp1%=%strtemp2%!")
pause

3. 文件名添加前缀

@echo off
for /f “delims=” %%f in (‘dir/b/s/a-d .’) do (if not “%%~nxf”=="%0" ren “%%f” “BmpTime%%~nxf”)

写博客不容易,需要大家多多支持。想了解更多,本人也可以提供有赏服务
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值