====== Command Lines ======

There are a number of places in [[:util:SCFG]] where a sysop may configure command-lines to be executed for certain features (e.g. doors, file transfer drivers, file archive/compression/test, etc.).

===== Modules =====
If the command-line is to be used to execute an internally evaluated module (either [[:util:Baja]] or [[custom:JavaScript]]), the command line should begin with an asterisk (''*'') or question mark (''?'') character. An asterisk indicates that a ''.js'' file should be executed from either the ''[[dir:mods]]'' or ''[[dir:exec]]'' directory if it exists, otherwise, to execute a ''.bin'' (Baja compiled) file (from either the ''[[dir:mods]]'' or ''[[dir:exec]]'' directory) if it exists. A question mark indicates to execute a ''.js'' file only (do not fall back to ''.bin''). The module file extension (e.g. ''.js'' or ''.bin'') is optional.

In summary:

^ Command-line ^ Description                                          ^
| *example     | Executes ''exec/example.js'' or ''exec/example.bin'' |
| ?example     | Executes ''exec/example.js'' only                    |

Note: The ''[[dir:mods]]'' directory or configured ''Start-up Directory'' (when relevant) are also searched for modules to execute.
===== Specifiers =====

Command lines configured in [[:util:SCFG]] may include //Command Line Specifiers// which are special sequences (macros) which will be replaced with useful dynamic values at the time the command line is executed by the BBS.

//Command Line Specifiers// may also be used in many string-related Baja functions and with the JavaScript ''bbs.cmdstr()'' method.

The currently supported //Command Line Specifiers// are:

^Specifer ^Description                ^Windows Example ^ Unix Example^
|''%A''	|Current user alias           |  ''digital man''        ||
|''%a''	|Current user alias (auto-quoted)  |  ''%%"digital man"%%''  ||
|''%b''	|Current baud (DTE) rate      |  ''38400 ''  ||
|''%c''	|Current connect description  |  ''Telnet''  ||
|''%d''	|Current connect (DCE) rate   |  ''30000 ''  ||
|''%e''	|Estimated CPS rate*10        |  ''30000 ''  ||
|''%F''	|File path/name             |''C:\SBBS\NODE1\DOOR.SYS''|''/sbbs/node1/door.sys''|
|''%f''	|File path/name (auto-quoted) |''%%"C:\Program Files\SomeFile"%%''|''%%"/some path/file/"%%''|
|''%g''	|Temporary file directory   |''C:\SBBS\NODE1\TEMP\''|''/sbbs/node1/temp/''|
|''%h''	|Socket descriptor (inheritable)  |  ''1402 ''      ||
|''%i''	|Current client IP address        |  ''127.0.0.1''  ||
|''%j''	|[[dir:DATA]] directory           |''C:\SBBS\DATA\''|''/sbbs/data/''|
|''%k''	|[[dir:CTRL]] directory           |''C:\SBBS\CTRL\''|''/sbbs/ctrl/''|
|''%l''	|Current maximum lines per message                   |  ''500''  ||
|''%m''	|Minutes in the current user's minute bank           |  ''0''  ||
|''%n''	|Current [[dir:node]] directory   |''C:\SBBS\NODE1\''|''/sbbs/node1/''|
|''%O''	|Sysop's name                     |  ''digital man''  ||
|''%o''	|Sysop's name (auto-quoted)      |  ''%%"digital man"%%''  ||
|''%p''	|Client protocol (e.g. Telnet, RLogin, SSH), or "raw" |                                ''raw''  ||
|''%q''	|System's QWK ID (as specified in SCFG)           |  ''VERT''  ||
|''%r''	|Client's terminal height (in rows)               |  ''24''  ||
|''%s''	|File specification or current command string     |''C:\FILES\*.ZIP''|''/files/*.zip''|
|''%t''	|Time (in seconds) user has left online           |  ''60''  ||
|''%u''	|UART I/O address in hex or F=FOSSIL              |  ''F''  ||
|''%v''	|Synchronet version                               |  ''3.15a''  ||
|''%w''	|Client's terminal width (in columns)             |  ''80''  ||
|''%x''	|Current user's command shell (internal code)     |  ''DEFAULT''  ||
|''%y''	|COMSPEC or SHELL environment variable   |''C:\Windows\system32\cmd.exe''|''/bin/sh''|
|''%z''	|[[dir:TEXT]] directory                  |''C:\SBBS\TEXT\''|''/sbbs/text/''|
|''%.'' |Executable file suffix/extension                 |''.exe''  | |
|''%~'' |File path/name in Micros~1 short format (Win32) |''C:\SOMEFI~1''|''/somefilename.txt''|
|''%!''	|[[dir:EXEC]] directory                           |''C:\SBBS\EXEC\''|''/sbbs/exec''|
|''%@'' |[[dir:EXEC]] directory only on Windows           |''C:\SBBS\EXEC\''|              |  
|''%#''	|Current Node number (1-255)                      |  ''1''  ||
|''%*''	|Current Node number (0 padded to 3 digits)       |  ''001''  ||
|''%$''	|User's credits                                   |  ''4534834''  ||
|''%+'' |User's real name (auto-quoted)                   |  ''"Rob Swindell"''  ||
|''%-'' |User's chat handle/call-sign (auto-quoted)       |  ''WX6YYZ''  ||
|''%%''	|Percent symbol                                   |  ''%''    ||
|''%?''	|Platform/operating system (build target)         |  ''win32''|''linux''|
|''%^'' |Processor architecture (build target)            |  ''i686''|''x64''|
|''%<'' |Client's terminal type (lowercase)               |  ''ansi''  ||
|''%>'' |Client's terminal character set/encoding (lowercase)   |  ''cp437''  ||
|''%1''	|Current user number                              |  ''1''    ||
|''%2''	|Current user number (0 padded to 2 digits)       |  ''01''   ||
|''%3''	|Current user number (0 padded to 3 digits)       |  ''001''  ||
|''%4''	|Current user number (0 padded to 4 digits)       |  ''0001''   ||
|''%(5-9)'' |Current user number (0 padded to 5-9 digits) |  ''00001''  ||

==== Auto-quoting ====

For most alphabetic specifiers, using uppercase or lowercase letters will produce the same results. The following specifiers support automatic quoting, enclosing the value in double-quote characters only when spaces are included in the expanded value. To prevent automatic quoting, use the uppercase version of the specifier (e.g. ''%A'' instead of ''%a'').

  * ''%a''
  * ''%f'' 
  * ''%o''

The ''%~'' specifier is always auto-quoted on non-Windows platforms (and never requires quoting on Windows platforms).
 
===== See Also =====
  * [[:util:SCFG]]


{{tag>configuration general_config scfg module door}}