I cannot get the following batch code to work if variable !batDir! contains spaces, e.g. W:\scripts windows\:
if /I "!i!" GTR "1" (
        Powershell "!batDir!ript.ps1 !test! '!testWithSpaces!' "
        goto :scriptEnd
)
W:\scripts : The term 'W:\scripts' is not recognized as the name of a cmdlet, function, script file, or operable
program.
 
    