详解 hl.exe 启动时可用的命令行参数 - 死亡粉笔

时间:2024-03-05 15:13:57

本文介绍的命令行参数适用于所有 GoldSource 引擎的游戏(例如 Half-Life 1、Counter-Strike 1.x 等)。

 语法hl.exe 命令行参数1 命令行参数2 控制台变量1 控制台变量2……
  示例:hl.exe -game cstrike -nojoy +_sethdmodels 0 -nomsaa(启动反恐精英、屏蔽游戏手柄、禁用高质量模型且关闭抗锯齿效果)

用途

These options can be used with:

  • Hammer editor Run Map dialog.
  • Windows shortcuts pointing to hl.exe directly.
  • Windows shortcuts pointing to steam.exe with the proper -applaunch <AppID> specified (see Steam section below).
  • Command-line batch script files launching these applications.
  • Game launch options from Steam\'s Library.

示例

  • steam.exe -applaunch 70 -dev -console -sw +sv_lan 1 +map MyMap
  • hl.exe -game cstrike -dev -console -fullscreen +sv_lan 1 +map de_dust

命令行参数

  • -game <game> - Specifies which game/mod to run. Default is "valve".
  • -dll <name.dll> - Specifies which game DLL to use. Ex: -dll dlls/zbotcz.dll.
  • -condebug - Stores console output to "Half-Life\qconsole.log".
     Note:Can be toggled with condebug console command.
  • -dev - Enables developer mode.
  • -glext - When paired with "-dev" setting, outputs all OpenGL extensions supported by your graphics card.
     Note:Can do the same with gl_dump console command.
  • -gl - Sets the rendered to OpenGL.
  • -soft - Sets the rendered to Software.
  • -full - Forces the engine to start in fullscreen mode.
  • -window or -sw or -startwindowed or -windowed - Forces the engine to start in windowed mode.
  • -w <width> or -width <width> - Forces the engine to start with resolution set to <width>. Ex: -w 1024.
  • -h <height> or -height <height>- Forces the engine to start with resolution set to <height>. Ex: -h 768.
  • -stretchaspect - The game by default adds black bars based on your game screen resolution. Use -stretchaspect on your command line if you want the old behavior back (just always fill the screen). Setting "-nofbo" also implies "-stretchaspect".
  • -freq <variable> - Force a specific refresh rate when running in fullscreen AND your monitor supports the frequency in question.
     Note:If you don\'t have a CRT monitor chances are you can\'t use this option.
  • -mousethread - If set we poll the mouse position in another thread running at 100hz by default, to get better movement accuracy. Set the "m_mousethread_sleep" cvar to the number of seconds to sleep between mouse polls to change this rate.
  • -joy_advanced - Use advanced joystick options (allows for multiple axes).
  • -joy_advr, -joy_advu, -joy_advv, -joy_advx, -joy_advy, -joy_advz - To do
  • -nosound - Disables sound support.
     Note:Can do the same with nosound <0 or 1> console command.
  • -nocdaudio - Disables mp3 support. Also disallows cd console command to load mp3 tracks.
  • -wavonly - Disables DirectSound and makes the engine attempt to play all sounds in PCM format.
  • -nointro - Disables intro movies.
  • -noip - Disables network support.
  • -noipx - Disables IPX support.
  • -nojoy - Disables joystick support.
  • -nomouse - Disables in-game mouse support.
  • -noforcemparms - Forces the engine to use operating system mouse parameters.
  • -noforcemaccel - Forces the engine to use operating system mouse acceleration.
  • -noforcemspd - Forces the engine to use operating system mouse speed.
  • -nofbo - Disables using the new method for rendering.
  • -nomsaa - Disables MSAA (Anti-Aliasing), setting "-nofbo" also implies "-nomsaa".
  • -noborder - When used with the game set to windowed mode, will make the game act as if in fullscreen mode (no window border).
     Bug:Doesn\'t hide window border, only control buttons.
  • -nodirectblit - Disables direct blitting (Blit is shorthand for "block image transfer" or bit blit).
  • -nobots - Disables bots.
  • -port <port> - Specifies which port to use for client connections for a listen server. Default is 27015.
     Note:Can do the same with port console command.
  • -demoedit - Enables hidden Demo editor.
     Note:Use viewdemo console command to get access.
  • -num_edicts <variable> - Sets the entity limit for map/game entities (not temporary entities, which is still locked to 500). 900 is default. 4096 is a good limit, beyond that seems to cause hunk_alloc errors[confirm]. Both clients and servers need matching values for best compatibility[confirm].
  • -heapsize <kilobytes> - Specifies the amount of heap(or free store - cache, an area of memory used for dynamic memory allocation) the engine will use. Minimum value is 14336(14 MB). Maximum value is 131072(128 MB). By default this is set to 40960 (40 MB) and automatically adjusted to suit your system.
     Note:Low value causes "Unable to allocate X.X MB" exit error.
  • -zone <bytes> - Specifies the amount of Bytes of memory for use with the console system.
     Note:Low or very high value causes Z_Malloc exit error.
  • -exec <file> - Executes specific config file immediately after the engine is loaded.
  • +<console variable> <arg> - Sets the Cvar (or console variable) to the specified setting.

常用的控制台变量

  • +_setgamedir <game> - Specifies which game/mod to run.
  • +_setrenderer <variable> - Sets the rendering mode. Available parameters are opengl and software.
     Note:Parameter D3D is deprecated.
  • +_setvideomode - To do
  • +_set_vid_level <0 or 1> - Toogles "Low video quality".
  • +_setaddons_folder <0 or 1> - Toogles "Allow custom addon content".
  • +_sethdmodels <0 or 1> - Toogles "Enable HD models if available".
  • +clientport <port> - Specifies which port to use to communicate with a server. Default is 27005.
  • +gg <demoname> or +cl_gg 1 +playdemo <demoname> - Runs the demo in Game Gauge mode. This is a benchmark utility that runs through a demo as fast as possible and stores the framerate in the file fps.txt in the GameMod directory.
  • +log on or +log off - Toogles logging before the engine loads config files.

弃用的命令行参数

  • -console - Enables console. Can be opened either from menu (button in top-left corner in old Half-Life builds or button in main menu in new builds), or by pressing tilde (~) in-game.
     Note:Always enabled by default.
  • -toconsole - Opens the console right when the game is launched.
     Note:No longer works.
  • -gldrv <driver name> - Selects the GL Driver. The two choices are "Default" and "3dfxgl.dll".
     Note:No longer works.
  • -d3d - Sets the rendered to Direct3D.
     Note:Removed.[1]
  • -vid_mode <variable> or -vt <variable> - Sets the rendering mode. Available parameters are gl and software.
     Note:No logner works. Use -gl-soft or -d3d(see above) instead.
  • -16bpp - Forces 16-bit color mode (bit depth).
     Note:Not allowed.
  • -32bpp - Forces 32-bit color mode (bit depth).
     Note:Enabled by default.
  • -nowinmouse - Don\'t capture mouse in-game.
     Note:Renamed to -nomouse.
  • -gamegauge <demoname> - Runs the demo in Game Gauge mode. This is a benchmark utility that runs through a demo as fast as possible and stores the framerate in the file fps.txt in the GameMod directory.
     Note:Use console commands instead.
  • -numericping - Displays ping in server browsers in milliseconds instead of dots.
     Note:Enabled by default.
  • -particles <variable> - The number of particles for which to set aside buffer space.
     Note:No longer works.
  • -nosierra - [confirm] To do
  • -noaff - Disables setting of thread affinity.
     Note:No longer works.

Steam (Windows)

These command-line parameters work when launching the Steam application (steam.exe) under Windows.

Command-line parameters

  • -applaunch %id %c - This launches an Game or Application through Steam. Replace the %id with the Game/Application ID number that you want to open up, replace %c with the command line parameters for the game as listed in the Source Games section above.
  • -cafeapplaunch - Launch apps in a cyber cafe context (Forces apps to be verified / validated before launch).
  • -clearbeta - Opts out of beta participation (in case for some reason it can\'t be done via settings).
  • -complete_install_via_http - Run installation completion over HTTP by default.
  • -console - Enables the Steam debug console tab.
  • -ccsyntax - Spew details about the localized strings we load.
  • -debug_steamapi - Enables logging of Steam API functions.
  • -developer - Sets the \'developer\' variable to 1. Can be used to open the VGUI editor by pressing F6 or VGUI zoo by pressing F7. Intended for skin development.
  • -fs_log - Log file system accesses.
  • -fs_target - Set target syntax.
  • -fs_logbins - Log the binaries we load during operation.
  • -forceservice - Run Steam Client Service even if Steam has admin rights.
  • -gameoverlayinject - Sets the method how GameOverlay is injected.
  • -install %p - Install a product from a specified path (e.g. "D:" for the DVD-ROM drive if D: is one).
  • -installer_test - changes installing a retail game to emit all files to install_validate/ folder instead of to the steam cache.
  • -language %l - Sets the Steam language to the one specified. (Examples: "english", "german").
  • -login %u %p - This logs into Steam with the specified Username and Password combination. Replace %u with the username, and %p with the password you want to login with (Steam must be off for this to work).
  • -lognetapi - logs all P2P networking info to log/netapi_log.txt.
  • -log_voice - writes voice chat data to the logs/voice_log.txt file.
  • -noasync - Don\'t use async file operations, run them synchronous instead.
  • -nocache - This starts steam with no cache (Steam must be off for this to work properly).
  • -no-dwrite - forces vgui to use GDI text even if DWrite support is available.
  • -script %s - This runs a Steam script. Replace %s with the script filename. All scripts must be in a subdirectory of the Steam folder called test scripts (Steam must be off for this to work).
  • -shutdown - This shuts down (exits) Steam.
  • -silent - This suppresses the dialog box that opens when you start steam. It is used when you have Steam set to auto-start when your computer turns on. (Steam must be off for this to work).
  • -single_core - Force Steam to run on your primary CPU only.
  • -tcp - forces connection to Steam backend to be via TCP.
  • -voice_quality - sets audio quality, range [1,3].
  • -voicerelay - Only allow \'relay\' connections for voice (testing).

HldsUpdateTool (Windows), steam (Linux)

Syntax: hldsupdatetool -command <command> [parameters] [flags]

Commands

  • -command update - Install or update HLDS.
  • -command version - View installed versions.
  • -command list - View available games.

Parameters for the update command

  • -beta <betaname> - Name of the beta (optional parameter for taking part in a beta test)
  • -game <game> - The name of the game to install (see enumeration).
  • -dir <installdir> - HLDS Install directory (if dir not specified, will use value from last run of tool).

The following parameters are only needed to access limited content.

  • -username <username> - Steam account username
  • -password <password> - Steam account password

Flags for the update command

  • -verify_all - Verify all HLDS files are up to date.
  • -retry - Automatically retry every 30 seconds if the Steam Network is busy.
  • -remember_password - Remember password (if a username is supplied).

Optional parameters for all commands

  • -nobootstrapupdate - Do not check for updates to the update tool

SteamCMD

The Steam Console Client or SteamCMD is a new tool to install and update dedicated servers using a command line interface. It only works with games that have switched over to the SteamPipe content system. Eventually all Steam games will switch from HLDSUpdateTool to this.

 Note:Command parameters are described inside the < and > characters.

Syntax: steamcmd.exe <parameter1> <parameter2> <cvar1> <cvar2>

Usage

  • steamcmd.exe +COMMAND1 [ARG] +COMMAND2 [ARG]
  • steamcmd.exe +runscript SCRIPTFILE

Command-line parameters

To do

Commands

To do

Examples

  • steamcmd.exe +login <username> <password> +force_install_dir <path> +app_update <appid> -validate

Source Dedicated Server

Command-line arguments for the Source Dedicated Server executable (<code>srcds.exesrcds_run)

Command-line parameters

-allowdebug
(Same as -debug ?)
-autoupdate
The server is searching for updates on startup (Linux/Unix only).
-console
SrcDS will run in console mode (Windows only).
-debug
Debug Mode.
-dev
Show developer messages.
-game <game or path>
Specifies which game/mod to run. Accepts either a path to a gameinfo.txt, or one of these pre-set values.
-insecure
Will start the server without Valve Anti-Cheat.
-ip
Specifies the address to use for the bind(2) syscall, which controls on which IP addresses the program is reachable on. It must either be a local address (an addresses of the host it runs on) or 0.0.0.0 (the wildcard). This has nothing to do with externally-visible addresses in NAT setups.
-maxplayers <number>
Specifies how many player slots the server can contain.
-nobots
Disable bots.
-nohltv
Disables SourceTV and closes its port (usually 27020).
-norestart
Won\'t attempt to restart failed servers.
-port
The port the server advertises to clients.
-steam
Use this (along with -console) when you are running the version of SRCDS downloaded through Steam.
-tickrate <number>
Specifies Server-Tickrate (for more info see Source Multiplayer Networking). This doesn\'t exist on TF2, CSS, L4D, and L4D2.
-timeout <number>
Sleep for <number> seconds before restarting a failed server.
-dumplongticks
Generate minidumps when there are long server frames
-usercon
Enables RCON for CS:GO Servers

Console variables

  • +<console variable> <arg> - Sets the Cvar (or console variable) to the specified setting.

Some useful console variables

  • +hostname "Server Name" - Specifies the name of the server.
  • +ip - Specifies the IP when multiple network cards are installed (Old, but still works).
  • +map <map> - Specifies which map to start.
  • +maxplayers <number> - Specifies how many player slots the server can contain (Old, but still works).
  • +hostport <port> - Specifies the host port (Port specification before -port was added, but can still be used).
  • +clientport <port> - Specifies the client port (The port the server advertises to clients, the same as -port and clientport in console)
  • +sv_lan <0/1> - If set to 1, server is only available in Local Area Network (LAN).

Linux command options in Left 4 Dead (2)

The linux version of Left 4 Dead and Left 4 Dead 2 dedicated server added extra server commands.

As part of the forking functionality mentioned below, the server parameters support substitution. For instance, if you specify +exec autoexec##.cfg, then the first server will execute autoexec01.cfg, the second autoexec02.cfg, and so on.

  • -netconport <number> - Creates a remotely accessible server console on the specified port. This can be connected to with telnet or similar applications, and allows controlling of the server as if the commands were being typed in at the console
  • -netconpassword "password" - It set, users must type PASS "password" to use the remote console described above
  • -fork <number> - Starts up the specified number of servers at once. They will each use the first available port number at 27015 or above.

Half-Life Dedicated Server

These command-line parameters are used with hlds.exe for Goldsource (Half-Life) games.

 Note:Command parameters are described inside the < and > characters.

Syntax: hlds.exe <parameter1> <parameter2> <cvar1> <cvar2>

Examples

  • hlds.exe -console -game cstrike +sv_lan 0 +maxplayers 22 +map de_dust2
  • ./hlds_run -game cstrike -autoupdate -pingboost 2 -port 27016 +maxplayers 20 +map de_dust2

Command-line parameters

  • -condebug - Stores console output to "Half-Life\qconsole.log".
     Note:Can be toggled with condebug console command.
  • -dev - Enables developer mode.
  • -autoupdate - The server is searching for updates on startup (no longer works?[confirm]).
  • -console - HLDS will run in console mode (Windows only).
  • -game <game> - Specifies which game/mod to run. Default is "valve".
  • -dll <name.dll> - Specifies which DLL to use. Ex: -dll addons\metamod\dlls\metamod.dll.
  • -nomaster - Disable communication with Master server. Use this parameter if you do not want your server to be listed in Server Browser.
     Note:Also disables server queries.
  • -insecure - Disables Valve Anti-Cheat technology.
  • -port <port> - Specifies which port to use for client connections. Default is 27015.
     Note:Can do the same with port console variable.
  • -sport <port> - Specifies the VAC port the server should use. Default is 26900.
     Note:You only need to change -sport if VAC connections fail through the primary port.
  • -noip - Disables network support.
  • -noipx - Disables IPX support.
  • -tos - Enables the LOWDELAY TOS header in the udp/ip packets the server generates. (Linux only)
  • -nobreakpad - Let plugin authors still get old style minidumps if they need it (win32 only)
  • -num_edicts <variable> - Sets the entity limit for map/game entities (not temporary entities, which is still locked to 500). 900 is default. 4096 is a good limit, beyond that seems to cause hunk_alloc errors[confirm]. Both clients and servers need matching values for best compatibility[confirm].
  • -heapsize <kilobytes> - Specifies the amount of heap(or free store - cache, an area of memory used for dynamic memory allocation) the engine will use. Minimum value is 14336(14 MB). Maximum value is 131072(128 MB). By default this is set to 40960 (40 MB) and automatically adjusted to suit your system.
     Note:Low value causes "Unable to allocate X.X MB" exit error.
  • -zone <bytes> - Specifies the amount of Bytes of memory for use with the console system.
     Note:Low value causes Z_Malloc exit error.
  • -maxplayers <number> - Sets the maximum number of players that will be able to join your server.
     Note:Can do the same with maxplayers console variable.
  • -sys_ticrate - Overrides sys_ticrate cvar.
  • -exec <file> - Execute specific config file immediately after the engine is loaded.
  • +<console variable> <arg> - Sets the Cvar (or console variable) to the specified setting.

Useful console variables

  • +hostname "Server Name" - Specifies the name of the server.
  • +ip <address> - Specifies the IP when multiple network cards are installed. Required for VAC2 operation.
     Note:Usually you do not need to specify this.
  • +map <map> - Specifies which map to start with.
  • +sv_lan <0/1> - If set to 1, server is only available in Local Area Network (LAN).
  • +mapchangecfgfile <file> - Like Server.cfg, ran after every round change, before Plugins are started.
  • -pingboost <1/2/3> - Selects between optimized HLDS network code stack. Set this on 2 usually reduces latency toward 1ms without loss of activity input packets.

 

 

本文译自:https://developer.valvesoftware.com/wiki/Command_Line_Options

posted on 2014-07-01 08:51  死亡粉笔  阅读(4576)  评论(0编辑  收藏  举报