diff --git a/packages/wdio-cli/src/utils.js b/packages/wdio-cli/src/utils.js
index <HASH>..<HASH> 100644
--- a/packages/wdio-cli/src/utils.js
+++ b/packages/wdio-cli/src/utils.js
@@ -354,12 +354,19 @@ export function getPathForFileGeneration(answers){
             process.cwd(),
             path.dirname(answers.pages || '').replace(/\*\*$/, ''))
         : ''
-    const relativePath = (answers.generateTestFiles && answers.usePageObjects)
+    let relativePath = (answers.generateTestFiles && answers.usePageObjects)
         ? !(answers.framework.short === 'cucumber')
             ? path.relative(destSpecRootPath, destPageObjectRootPath)
             : path.relative(destStepRootPath, destPageObjectRootPath)
         : ''
 
+    /**
+    * On Windows, path.relative can return backslashes that could be interpreted as espace sequences in strings
+    */
+    if (process.platform === 'win32') {
+        relativePath = relativePath.replace(/\\/g, '/')
+    }
+
     return {
         destSpecRootPath : destSpecRootPath,
         destStepRootPath : destStepRootPath,
fix(cli): backslash replacement on win<I> (#<I>)