Fix dirname detection on Windows systems

On Windows systems function `dirname` fails and always return `.`
This fix replace all Windows backslashes `\` to Unix forward slashes `/` in script path, so `dirname` return proper dir.