diff --git a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
index d27be965e8..86915fb993 100644
--- a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
+++ b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
@@ -36,6 +36,7 @@ import org.openstreetmap.josm.data.projection.ProjectionRegistry;
 import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
 import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.ProgramArguments;
 import org.openstreetmap.josm.gui.io.CustomConfigurator;
 import org.openstreetmap.josm.gui.io.importexport.FileImporter;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -107,7 +108,7 @@ public class ValidatorCLI implements CLIModule {
         /** --load-preferences=&lt;url-to-xml&gt;     Changes preferences according to the XML file */
         LOAD_PREFERENCES(true, 'p'),
         /** --set=&lt;key&gt;=&lt;value&gt;           Set preference key to value */
-        SET(true, 's');
+        SET(true, 's', OptionParser.OptionCount.MULTIPLE);
 
         private final String name;
         private final boolean requiresArgument;
@@ -467,7 +468,9 @@ public class ValidatorCLI implements CLIModule {
             }
             break;
         case SET:
-
+            final Map.Entry<String, String> keyValue = ProgramArguments.parsePreferenceToSet(argument);
+            Config.getPref().put(keyValue.getKey(), keyValue.getValue());
+            break;
         default:
             throw new AssertionError("Unexpected option: " + option);
         }
diff --git a/src/org/openstreetmap/josm/gui/ProgramArguments.java b/src/org/openstreetmap/josm/gui/ProgramArguments.java
index 58353d1378..6b0ec01417 100644
--- a/src/org/openstreetmap/josm/gui/ProgramArguments.java
+++ b/src/org/openstreetmap/josm/gui/ProgramArguments.java
@@ -1,6 +1,7 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui;
 
+import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -201,10 +202,21 @@ public class ProgramArguments {
      */
     public Map<String, String> getPreferencesToSet() {
         HashMap<String, String> map = new HashMap<>();
-        get(Option.SET).stream().map(i -> i.split("=", 2)).forEach(kv -> map.put(kv[0], getValue(kv)));
+        get(Option.SET).stream().map(ProgramArguments::parsePreferenceToSet).forEach(e -> map.put(e.getKey(), e.getValue()));
         return map;
     }
 
+    /**
+     * Parses a {@code --set} argument.
+     * @param keyValue the argument, in the form {@code key=value}
+     * @return the key and the value. The value is empty if missing, and {@code null} if it is "null"
+     * @since xxx
+     */
+    public static Map.Entry<String, String> parsePreferenceToSet(String keyValue) {
+        String[] kv = keyValue.split("=", 2);
+        return new AbstractMap.SimpleEntry<>(kv[0], getValue(kv));
+    }
+
     private static String getValue(String... kv) {
         if (kv.length < 2) {
             return "";
diff --git a/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java b/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
index f54343a3ff..672294b583 100644
--- a/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
+++ b/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
@@ -190,6 +190,17 @@ class ValidatorCLITest {
         assertEquals(Collections.singletonList("baz"), Config.getPref().getList("plugins"));
     }
 
+    /**
+     * Test the --set argument
+     */
+    @Test
+    void testSetPreference() {
+        validatorCLI.processArguments(new String[]{"-s", "test.key=foo=bar", "--set=test.other=baz",
+                "--input", "resources/styles/standard/elemstyles.mapcss"});
+        assertEquals("foo=bar", Config.getPref().get("test.key"));
+        assertEquals("baz", Config.getPref().get("test.other"));
+    }
+
     /**
      * Read json objects from a file
      * @param path The file to read
