3ds Max Startup Script Execution Order and Initialization Sequence
0 reputation · 23 Sept 2022, 09:01 UTC
0 reputation · 23 Sept 2022, 09:01 UTC
Creating a repeatable development environment in 3ds Max often requires the use of command-line flags to ensure consistent plugin paths and global variables across different workstations. The application supports the -U flag for user startup scripts and the -s flag for executing specific scripts upon launch.
While the -U script typically executes before the -s script, the precise interaction between these flags and the implicit startup scripts defined in the 3dsmax.ini file is not fully detailed. In complex environments where both system-level and user-defined scripts are present, the sequence of execution can impact the final state of the environment variables.
Given these constraints, how is the execution priority determined when -U and -s flags are used in conjunction with 3dsmax.ini StartupScripts? Does the -U flag override or append to the existing initialization sequence?
34775 reputation · 23 Sept 2022, 12:45 UTC
When both -U (user startup) and -s (script at launch) flags are supplied, 3ds Max processes them in the following order:
scripts/startup folder (if present).-U script, which is executed after the system startup folder scripts.-s script, which runs after the -U script.3dsmax.ini file’s [StartupScripts] section, which are executed after all command‑line scripts.Thus, -U does not override the 3dsmax.ini list; it simply appends its execution after the default system folder scripts and before any INI‑specified scripts.
-U flag is processed after the standard scripts/startup folder but before the -s flag.3dsmax.ini file may contain a [StartupScripts] section; scripts listed here run last, regardless of command‑line flags.Older releases (pre‑2023) may reverse the -U and -s order, or may merge the -U script into the INI list. Because Autodesk does not publish a definitive sequence in the public docs, the safest assumption is to treat -U as an additional step that runs after the system folder scripts.
userStartup.ms and launchScript.ms, each writing a timestamped line to C:\temp\startup.log.
-- userStartup.ms
writeFile "C:\\temp\\startup.log" (getDateString() + ": userStartup executed\n")
-- launchScript.ms
writeFile "C:\\temp\\startup.log" (getDateString() + ": launchScript executed\n")3dsmax.exe -U "C:\\path\\userStartup.ms" -s "C:\\path\\launchScript.ms"C:\temp\startup.log and confirm the order of the two lines. The -U line should appear before the -s line.
[StartupScripts] entry in 3dsmax.ini pointing to a third script that writes its own timestamp. Verify that its entry appears last in the log.If you observe a different order (e.g., -s before -U), the behavior is likely tied to the specific 3ds Max version or a custom configuration. In that case, document the observed sequence and adjust your automation scripts accordingly.
To give a definitive recommendation for your environment, could you confirm which 3ds Max release you are using (e.g., 2024 R1, 2025 R2, etc.)?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.