Windows Script Host - Jscript equivalent of perl CWD

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,754
Reaction score
533
Hi All,

I google but couldn't find any example of Jscript equivalent of perl CWD(getcwd()). Would appreciated if anyone can provide some tips on this.

Thanks in advance.

Found it!
function GetPath()
{
// Retrieve the script path.
var path = WScript.ScriptFullName; // Script filename
path = path.substr(0, path.lastIndexOf("\\") + 1);
return path;
}
 
Last edited:

jackoats.sg

Junior Member
Joined
Feb 11, 2020
Messages
78
Reaction score
1
I just wonder does using Windows Scripting Host mean running it on older version of Windows?

Peter you know it might not be a good security practice.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top