The safe mode option allows users to run scripts in a protected mode for some system commands. This feature is available in the 2020b R1 release.
The following script commands are disabled when script safe mode is on:
system, read, write, cp, mv, rm, del
Note that certain format of files can still be written in safe mode, and the formats include ".txt", ".dat", ".bsdf" and ".sdf". Running disabled commands in safe mode will trigger an error message, which contains a link to this page. Users can use the try/catch blocks to test the status of the safe mode.
To turn on and off the safe mode, users can use the Safe-mode checkbox in the products:
The product configuration file will remember the status of the safe mode checkbox, and it will initiate the project file accordingly when it is created.
The Safe-mode is turned on by default. Users can also turn it on and off from the command line by using the "-safe-mode" flag and "-trust-script" flag:
-safe-mode
to turn on the safe mode, and
-trust-script
to turn off the safe mode. Note that the command line flag does not affect the configuration file value. More details can be found here.