本文实例讲述了JavaScript获取当前运行脚本文件所在目录的方法。分享给大家供大家参考,具体如下: DirectoryUtility = { // function getCurrentDirectory: returns currentDirectory path // with a trailing backslash. getCurrentDirectory : function ( ) { var scriptFullName = WScript.ScriptFullName; var scriptName = WScript.ScriptName;