读取sln文件并删除关联工程生成的最小obj文件

@echo off
Setlocal Enabledelayedexpansion

set CurrentSln=test.sln
set SaveData=aaaa1

:: 临时文件名称
set tmpFile=last.tmp	
if exist %tmpFile% (

	set /P LastData=<%tmpFile%

	if defined LastData (
		if %SaveData% == !LastData!  (
			goto:eof
		)
	)
)

call :read_sln %CurrentSln%
echo %SaveData%>%tmpFile%
goto:eof

:read_sln
for /f "delims=" %%i in ('findstr /i /c:"\\" %1') do (
	:: echo %%i
	for %%f in (%%i) do (
		echo %%f | findstr /c:"\\"  >nul && (
			 :: echo %%~f
			 :: 删除 x64\Release 目录下最小的obj文件
			 call :del_min_obj %%~f\..\x64\Release
		)
	)
)

goto:eof

:: para1=path
:del_min_obj 
for /f "delims=" %%i in ('dir /b /a-d /os  %1\*.obj') do (
set /a n+=1 & if !n!==1 set "file=%%~i")
:: echo;删除最小的obj文件:%file%
del %1\%file%
goto:eof
上一篇:<009>VsCode代码全红解决方案


下一篇:obs-studio 二次开发【vs2017环境搭建】