Format C++ code at will

download tool

Download Artistic Style from SourceForge.net

configuration path

Unzip the style.exe in the bin directory in the above folder into a folder, and then add this folder to the system variable Path (My Computer-Advanced System Settings-Environment Variables-System Variables-Add Folder in Path path)

script execution

The following code is stored in run.bat, and then run

set ast="astyle.exe"
REM
for /r . %%a in (*.cpp;*.h) do %ast% --style=allman --align-pointer=name --attach-closing-while --indent-col1-comments --pad-oper  --pad-header "%%a"
REM
for /r . %%a in (*.orig) do del "%%a"
pause

Guess you like

Origin blog.csdn.net/qq_33882435/article/details/128318033