The purpose
Inkscape can create SVGs, but they contain Inkscape-specific data which makes the file size larger than a normal SVG. They may also include absolute file paths, which can contain a user name.
While Inkscape-specific SVGs are more convenient during the creation process, it’s better to remove this data when releasing the final version.
This article will introduce a batch script (.bat
file) that removes Inkscape-specific data from SVG files within a folder.
“For workflow efficiency, I have set it up to overwrite the original files.
Please be sure to back up your files so that you can restore them to their original state. In this article, I will introduce a batch file that deletes Inkscape-specific data from SVG files within a folder.”
Bat
First, create a file named svg.bat
and save it in the folder where the SVG files you want to convert are located.
If Inkscape is not installed at “C:\Program Files\Inkscape”, please change the path accordingly.
setlocal enableDelayedExpansion
set "TARGET_DIR=."
set "FILE_PATTERN=*.svg"
for %%f in ("%TARGET_DIR%\%FILE_PATTERN%") do (
"C:\Program Files\Inkscape\bin\inkscapecom" "%%~f" --export-plain-svg --export-filename="%%~f"
)
pause
endlocal
Inkscape’s GUI executable is inkscape
, but its CLI (Command Line Interface) executable is inkscapecom
.
“The syntax --export-plain-svg="output_file"
does not work.
The output file should be specified with --export-filename
.”
Result
“The batch file successfully deleted the Inkscape-specific data from the SVG files.
A comparison of the files before and after running the batch file shows that the Inkscape-specific information has been removed as follows.”

comment