Return to the technote repository Command Line
Options

Introduction

You can set all informations of the magic.ini at the magic command line.

The format is mggenw /[SECTION_NAME]variable_name=value. If the section name is [MAGIC_ENV], you can safely use mggenw /variable_name=value.

You can set the user login and password by using the following undocumented flags : mggenw /user=USER /password=PASSWORD.

You can set the magic.ini using the /ini=yourmagic.ini argument, so the magic.ini can have a different name, and a different path than the current one. You could also specify the magic.ini path by putting this path in the "start in" field of the .lnk (link) file.

If you want to set a path, you should note that \ are interpreted, there is 3 solutions :

  • double the \ : /[MAGIC_LOGICAL_NAMES]TEMP=C:\\TEMP\\,
  • use ' : /[MAGIC_LOGICAL_NAMES]TEMP='C:\TEMP\',
  • prefix by * : /[MAGIC_LOGICAL_NAMES]TEMP=*C:\TEMP\.

I prefer the last solution because this trick also works for the INIPUT function.

You can put all command line arguments in one or several files. For instance, use mggenw @commands.prm, where commands.prm is the command line file :

; commentary (use ;)
; from [MAGIC_ENV] section
/Terminal=0
/MultiUser=Y

/[MAGIC_LOGICAL_NAMES]TEMP=*C:\TEMP\
; You can put the / or not
[MAGIC_LOGICAL_NAMES]PATH=*C:\PATH\

Utilization

It is a good idea to have a magic.ini by user, so you can set user settings in the magic.ini, as well as limit problems (concurrent access may cause magic.ini corruptions).

However, having several magic.ini cause maintenance problem when you have to change a flag in all this magic.ini.

For better performances, you should set the magic.ini as resident ([MAGIC_ENV]ResidentINI=Y). It means that Magic load the magic.ini only at startup, and saves it back when Magic ends. So if an external program (such as a Magic task using 'get.iniput') changes several magic.ini, the change will be overwritten for currently opened sessions.

The solution is to use one or several command lines files. The changes will be active for each new Magic session (so you have to wait that each user stop and relaunch Magic in order to complete the change).

You can for instance set up a new CTL without forcing current users to quit, but only if files structures doesn't change. With the /[MAGIC_SYSTEMS]System? command line argument, you can set the CTL name from ctl_path_1 to ctl_path_2, where ctl_path_1 is your current CTL, and ctl_path_2 your new CTL. So each new Magic session will use the ctl_path2, but opened sessions use the former ctl_path_1 CTL.