2SergOst
>> А эту функцию тоже можно в *.js файл запихать и в нем вызывать?
Using Windows Script Files (.wsf)
A Windows script (*.wsf) file is a text document containing Extensible Markup Language (XML) code. It incorporates several features that offer you increased scripting flexibility. Because Windows script files are not engine-specific, they can contain script from any Windows Script compatible scripting engine. They act as a container.
With .wsf files, you can take advantage of the following features as you create your scripts:
.wsf files support
Include statements, Multiple engines,Type libraries, Tools,Multiple jobs in one file.
Include Statements
If you have .js and .vbs files from previous Windows Script Host projects, a .wsf file enables you to use them with Windows Script Host. A .wsf file encapsulates a library of functions that can in turn be used by multiple .wsf files.
The following example shows a .wsf file that includes a JScript file (fso.js), plus a VBScript function that calls a function (GetFreeSpace) in the included file. The contents of fso.js are also shown.
<job id="IncludeExample">
<script language="JScript" src="FSO.JS"/>
<script language="VBScript">
' Get the free space for drive C.
s = GetFreeSpace("c:"
WScript.Echo s
<sScript>
</job>
The fso.js file contains the following:
function GetFreeSpace(drvPath) {
var fs, d, s;
fs = new ActiveXObject("Scripting.FileSystemObject"
;
d = fs.GetDrive(fs.GetDriveName(drvPath));
s = "Drive " + drvPath + " - " ;
s += d.VolumeName;
s += " Free Space: " + d.FreeSpace/1024 + " Kbytes";
return s;
}
>>функция не совсем понятна: что имеется в виду под Path, когда диск подключен? UNC имя что-ли? (в моем случае \\comp1\c$ ?)
>>Если да, то оно прямо так в кавычках строкой и подставляется в вызов функции, как и "n:"?
Под Path имеется в виду UNC имя, записывается в кавычках, например CheckNetworkMapping("n:","\\\\disk\\dir"