Command Line Options
DS4Windows supports command line options when DS4 process is running in the background. Manage your DS4windows from the command line or utilize the commands for troubleshooting DS4Win.
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.
Since DS4Windows 3.x version – now uses the new technical platform and the recommended way to send command line commands to DS4Windows is the optional DS4WindowsCmd.exe addon tool.
DS4Windows.exe -command stop DS4Windows.exe -command start DS4Windows.exe -command cycle DS4Windows.exe -command shutdown DS4Windows.exe -command LoadProfile.<controller#>.<profile name> DS4Windows.exe -command LoadTempProfile.<controller#>.<profile name> DS4Windows.exe -command OutputSlot.<slot#>.Unplug DS4Windows.exe -command OutputSlot.<slot#>.PlugDS4 DS4Windows.exe -command OutputSlot.<slot#>.PlugX360 DS4Windows.exe -command Disconnect.<controller#> DS4Windows.exe -command Disconnect DS4Windows.exe -command Query.<controller#>.<property name> DS4Windows.exe -driverinstall DS4Windows.exe -re-enabledevice
Stop/Start/Cycle commands does the same as “Stop/Start” button in DS4Windows settings screen. Cycle option switches between stop and start states.
- DS4Windows.exe -command Start command would start DS4Windows and connect all supported gamepads to DS4Windows app if the DS4Windows background process is running (ie. this command won’t launch the DS4Windows background process if it is not already running. Run DS4Windows.exe without any options to launch the background process).
- Stop command doesn’t shutdown the DS4Windows process, but just disconnects all controllers from the application. The next time you call START command (or press START button in DS4Windows GUI) then all controllers are re-connected.
- Cycle command switches between stop and start states.
Shutdown command disconnects all controllers and shutdowns the DS4Windows application.
LoadProfile/LoadTempProfile commands load and activates a profile.
- 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.
- LoadProfile cmd loads and sets a new default profile (as shown in Controllers tab page in DS4Windows GUI). LoadTempProfile loads a profile and uses it until you load a new profile, but doesn’t change the default profile configuration selection (the next time you start DS4Windows app the default profile is what it used to be originally).
OutputSlot command unplugs or plugs a virtual output controller in a specified output slot (OutputSlot tab page in DS4Windows GUI).
- DS4Windows.exe -command OutputSlot.1.Unplug would unplug a virtual output controller from slot 1 (if the slot has permanent output controller and it is at unbound state without physical gamepad connection).
- DS4Windows.exe -command OutputSlot.1.PlugX360 would plug a virtual output controller with X360 output mode (PlugDS4 would do the same, but using DS4 output controller type).
Disconnect command disconnects a specified controller or all controllers.
- DS4Windows.exe -command Disconnect.1 would disconnect the first controller.
- DS4Windows.exe -command Disconnect would disconnect all controllers.
Query command queries a value of profile or app setting and prints out the result to a console.
- DS4Windows.exe -command Query.1.ProfileName > mydata.txt would write the name of the current profile to the mydata.txt text file.
- Supported property names are:
- ProfileName = The name of the current profile
- OutContType = The virtual output controller type set in a profile (xbox360 or dualshock4)
- ActiveOutDevType = The virtual output controller type (active status, usually the same as OutContType value, but if the controller is in disconnected state then this returns NONE value).
- UseDInputOnly = The value of “Use DInput Only” profile option
- DeviceVIDPID = The vendor and product hardware ID of the specified controller
- DevicePath = The hardware device path of the controller
- MacAddress = The MAC hardware address of the controller
- DisplayName = The display name of the controller device (as set by vendor)
- ConnType = The connection type (USB, BT, SONYWA)
- ExclusiveStatus = The status of exclusive controller access (see “Hide DS4 Controller” option explanation in this documentation)
- Battery = The current battery level 0..100 (the value returned as text output and in the numerical errorlevel environment variable)
- Charging = The charging status (the value returned as True/False text output and in the numerical errorlevel environment variable as 1 or 0)
- OutputSlotType = The current type of the slot (DS4 or X360)
- OutputSlotPermanentType = The permanent type of the slot (None, DS4 or X360. None means that the slot is dynamic). Unplug command can unload virtual output devices from a permanent slot if the slot is not bound (=unbound) to an input device (physical device)
- OutputSlotAttachedStatus = The status of attached device in the slot (Attached or Unattached)
- OutputSlotInputBound = The status of input bound (Bound or Unbound)
- AppRunning = The running status of the background DS4Windows application process (True=DS4Windows app is running, False=DS4Windows app is not running. The boolean value is also set in errorlevel environment variable).
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.
Additional DS4WindowsCmd.exe command line tool for easier batch script integration (optional tool)
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 app also, but it would require additional Windows batch script tricks because of lack of console and “fire and forget” type of command calls. The problem is that the normal DS4Windows.exe app you use is not a WinOS console appliction, but a GUI application. This makes it a bit more difficult to integrate WinOS GUI applications with a batch script. The solution is an optional DS4WindowsCmd tool. The DS4WindowsCmd.exe tool makes it easier to query property 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. This is optional and not required to run DS4Windows app or to use command line interface. You can use the normal DS4Windows.exe app directly, but it has those couple WinOS related limitations with batch scripts (command line calls are not synchronized and the output console is missing).
@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 DS4WindowsCmd.exe -command Query.1.Battery set DS_BATTERY=%errorlevel% if "%DS_BATTERY%" == "1000" echo ERROR. Could not read the battery level. Maybe DS4Windows app is not running or the controller is disconnected. echo Results are %DS_PROFNAME% %DS_CONTROLLERTYPE% %DS_CONNTYPE% %DS_VIDPID% %DS_BATTERY%
See also “https://github.com/Ryochan7/DS4Windows/pull/1394” post for more info about the DS4WindowsCmd.exe tool.
Here is an example script using the DS4WindowsCmd.exe tool and various cmdline commands: https://github.com/mika-n/DS4WindowsCmd/blob/master/ExampleScript.bat
Note! The first command line parameter (-command/driverinstall/re-enabledevice) needs to be in lowercase letters.