-
Notifications
You must be signed in to change notification settings - Fork 840
Command line options
DS4Windows (since version V1.7.13) supports following command line options when a main DS4Windows process is already running in the background. Windows BAT/CMD batch file or 3rd party application can use these commands to automate stop/start/shutdown or loadProfile operations.
DS4Windows.exe -command stop
DS4Windows.exe -command start
DS4Windows.exe -command shutdown
DS4Windows.exe -command LoadProfile.<controller#>.<profile name>
DS4Windows.exe -command LoadTempProfile.<controller#>.<profile name>
DS4Windows.exe -command Query.<controller#>.<property name>
DS4Windows.exe -driverinstall
DS4Windows.exe -re-enabledevice
Stop/Start commands does the same as "Stop/Start" button in DS4Windows settings screen. ``Stop command doesn't shutdown the DS4Windows process, but just disconnects all controllers from the application.
**Shutdown **command disconnects all controllers and shutdowns the DS4Windows main process (ie. the application is closed).
LoadProfile/LoadTempProfile commands load and activates a profile. ``For example "DS4Windows.exe -command LoadProfile.1.SnakeGame" command would load a profile named SnakeGame for the first connected controller. This is useful command if you use batch files to launch games and want to automate the selection of correct profile without using auto-profile feature of DS4Windows.
Query command queries a value of certain profile or app setting and prints out the result. For example "DS4Windows.exe -command Query.1.ProfileName" would return the name of the current profile. Supported property names are: ProfileName, OutContType, ActiveOutDevType, UseDInputOnly, DeviceVIDPID, DevicePath, MacAddress, DisplayName, ConnType, ExclusiveStatus, AppRunning
DriverInstall shows a dialog and prompts to install required ViGem virtual gamepad driver. Normally DS4Windows does this automatically when the app detects that the virtual gamepad driver is missing.
Re-EnableDevice enables a gamepad device in exclusive mode if it's stuck in disabled state. Normally DS4Windows does this automatically when the app is closed and exclusive mode is no longer needed.
Here is an example script using the optional DS4WindowsCmd.exe cmdline tool to query certain DS4Windows runtime properties. The same would be possible with DS4Windows.exe host app also, but it would require additional Windows batch script tricks because of lack of console and "fire and forget" type of command calls. DS4WindowsCmd.exe tool makes it easier to query DS4Windows option values and synchronize the result with standard Windows batch scripts.
Download the DS4WindowsCmd.exe tool from https://github.com/mika-n/DS4WindowsCmd site if you want to use the easier Windows batch script integration logic. However, this is optional and not required to run DS4Windows app or you can use the DS4Windows.exe host command directly, but it has few Windows OS related issues (command line calls are not synchronized and the console is missing, so query output is not shown in a console).
@echo off
echo.
echo Query the name of the current DS4Windows profile, output controller type (Xbox360 vs DS4) and connection method (USB vs BT) and device vendor/product id.
echo This script uses DS4WindowsCmd.exe cmdline tool to talk to the host DS4Windows app running in the background.
echo Run DS4WindowsCmd.exe command in a cmd shell to see the full list of supported commands.
echo.
for /f "tokens=*" %%i in ('DS4WindowsCmd.exe -command Query.1.ProfileName') do set DS_PROFNAME=%%i
for /f "tokens=*" %%i in ('DS4WindowsCmd.exe -command Query.1.OutContType') do set DS_CONTROLLERTYPE=%%i
for /f "tokens=*" %%i in ('DS4WindowsCmd.exe -command Query.1.ConnType') do set DS_CONNTYPE=%%i
for /f "tokens=*" %%i in ('DS4WindowsCmd.exe -command Query.1.DeviceVidPid') do set DS_VIDPID=%%i
echo Results are %DS_PROFNAME% %DS_CONTROLLERTYPE% %DS_CONNTYPE% %DS_VIDPID%
See also "https://github.com/Ryochan7/DS4Windows/pull/1394" post for more info about the DS4WindowsCmd.exe tool.
Note! The first command line parameter (-command/driverinstall/re-enabledevice) needs to be in lowercase letters.