How to test command line without exporting the project?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GrandNecro

Is there a setting in the Godot ide that allows me to set the command line arguments for my project? I want to test how my parsing code works, but don’t want to have to export the game as an executable everytime to test it.

:bust_in_silhouette: Reply From: spaceyjase

Not from the editor directly (unless another reader knows otherwise, please correct me!). However, godot is just running itself with some command line args to the project; you could run this directly from CLI without exporting:

<path_to_godot>/godot.exe --path <path_to_project>

You can specify additional args here.

Ideally, you’d run this from the project’s folder. Using an external IDE (such as Rider or Visual Studio Code), it’s also possible to change the debug configuration to include additional args.

Thanks! this worked well.
Also note to future readers who might have the same problem:
I found it useful to rename "“Godot_v4.0-stable_win64.exe” to “godot.exe”
then add the directory containing the executable to the environment path. This way, it easy to run the command argument from anywhere.
Ex:

godot --path <path_to_proj> --ip=123.123.123.1 --port=4321 --headless

GrandNecro | 2023-03-16 04:35

:bust_in_silhouette: Reply From: aidave

You can run Godot from command line, like:

./Godot_v4.0-stable_linux.x86_64 project.godot -- arg1 arg2 arg3

Then use:

OS.get_cmdline_user_args()

To get arguments into your game

Also try:

--help

At command line for more options

Docs:

:bust_in_silhouette: Reply From: zhyrin

Project Settings (advanced) > Editor > Run > Main Run Args