diff --git a/tests/data/test3021 b/tests/data/test3021
index bd6ae8d6dc..1b23ff0482 100644
--- a/tests/data/test3021
+++ b/tests/data/test3021
@@ -30,6 +30,11 @@ SFTP correct sha256 host key
--hostpubsha256 %SSHSRVSHA256 --key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/log/file%TESTNUMBER.txt
+
+# Needed for MSYS2 to not treat the argument as a POSIX path list
+# that has to be converted to Windows paths
+MSYS2_ARG_CONV_EXCL=/
+
test
diff --git a/tests/data/test3022 b/tests/data/test3022
index db24ca9f4a..3e117701ad 100644
--- a/tests/data/test3022
+++ b/tests/data/test3022
@@ -30,6 +30,11 @@ SCP correct sha256 host key
--hostpubsha256 %SSHSRVSHA256 --key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/log/file%TESTNUMBER.txt
+
+# Needed for MSYS2 to not treat the argument as a POSIX path list
+# that has to be converted to Windows paths
+MSYS2_ARG_CONV_EXCL=/
+
test