Hi,
I have sample code which needs to get the current
directory from where the file runs,it works with windows
script host 5.6, but not it with 5.1
I read and found that current directory property is
available in 5.6 not 5.1
Wanted to find out the equivalent of it in 5.1.
// sample code//
var WshShell = WScript.CreateObject ("WScript.Shell");
var fso, f;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
var sfile = WshShell.CurrentDirectory;
WScript.Echo(sfile);
///
Joe Fawcett - 03 Jul 2003 08:50 GMT
> Hi,
>
[quoted text clipped - 16 lines]
> WScript.Echo(sfile);
> ///
Try using the filesysytemobject, run this from a folder other than C:\ as a
test:
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oFolder = oFSO.getFolder(".");
WScript.echo("From FSO: " + oFolder.path);
var oShell = new ActiveXObject("WScript.Shell");
WScript.echo("From WScript.Shell: " + oShell.currentDirectory);
oShell.currentDirectory = "C:\\";
oFolder = oFSO.getFolder(".");
WScript.echo("From FSO: " + oFolder.path);
WScript.echo("From WScript.Shell: " + oShell.currentDirectory);
oFolder = null;
oFSO = null;
oShell = null;

Signature
Joe