(Solved) Cant save Blender file with an instance launched from the cmd line (windows 10) "Cannot change old file (file saved with @)"

Hi there! Im developing an automated “version selector” for Blender in C++. Im using system("") to launch an instance of Blender.exe (I cant/dont want to use the blender-launcher.exe as its not present in versions older than 2.93) with the blender file I want to open as the first (and only) cmd line argument.

The software is working as intended in general, the issue Im facing is that every time I try launching a Blender instance from the cmd line like blender.exe myFile.blend or start blender.exe myFile.blend (the last one launches blender in a new console window) that particular Blender instance becomes unable to save its file contents to the blend that I fed as cmd line argument.

Any advice is welcome <3 I dont have any 3rd party AV installed and I already tried disabling windows built in AV in case it would solve the issue (of which it didnt)

this is the github repo btw: BlenderVersionSelector/main.cpp at main · ItsCubeTime/BlenderVersionSelector · GitHub search for string systemCmdToExecute if you wanna look at the code. Although the issue appears also when just manually typing blender.exe myFIle.blend directly from an instance of cmd prompt

This is unrelated to your question, but please don’t use system() with unsanitized user input.

I totally agree that this is not a good solution. However STD seems to lack cross platform alternatives.

The reason for me using it is to avoid having to rewrite the same code to start the Blender process for each OS in the case that I want to make the software fully cross-platform.

Stupid me however :slight_smile: Turns out that I had just forgotten to close the .blend file after extracting the file header from it. Problem solved