Fix cli incompatibility with Windows

When checking for the last slash, use DIRECTORY_SEPARATOR to make the script work correctly when executed under Windows.

PS: can be applied to earlier versions