PLAM.RU


  • Echo WScript
  • Write WriteLine WScript.StdOut
  • MsgBox VBScript
  • Popup WshShell
  • WSH
  • ( Microsoft Word)
  • Windows
  • ,
  • DOS
  • DOS,
  • Windows
  • Windows
  • ,
  • .
  • 2

    WSH (JScript VBScript)

    , WSH 5.6, 1, , , , , ( , ), , . JScript, VBScript, .

    ( ) :

    ?

    Echo
    WScript
    ;

    ?

    Write
    WriteLine
    WScript.StdOut
    ;

    ?

    MsgBox
    VBScript;

    ?

    Popup
    WshShell
    .

    Echo WScript

    WScript.Echo
    , JScript VBScript, 2.1 2.2.

    Echo , Windows- (CP 1251).

    2.1. Win-
    WScript.Echo
    (JScript)

    /*******************************************************************/

    /* : Echo1.js */

    /* : JScript */

    /* : WScript.Echo */

    /*******************************************************************/

    // ()

    WScript.Echo(" Echo (Win-)");

    //

    WScript.Echo(", 1+2=",1+2);

    /************* *********************************************/

    2.2. Win- WScript.Echo (VBScript)

    '*******************************************************************

    ' : Echo1.vbs

    ' : VBScript

    ' : WScript.Echo

    '*******************************************************************

    ' ()

    WScript.Echo " Echo (Win-)"

    '

    WScript.Echo ", 1+2=",1+2

    '************* *********************************************

    Echo1.js (Echo1.vbs) cscript.exe, (. 2.1).

    wscript.exe, OK (. 2.2).

    , (. 2.3). , : escape- "

    \n
    " JScript
    vbCrLf
    VBScript ( 2.3 2.4).

    . 2.1. Echo1.js cscript.exe


    . 2.2. Echo1.js wscript.exe


    . 2.3.


    2.3. (JScript)

    /*******************************************************************/

    /* : Echo2.js */

    /* : JScript */

    /* : (WScript.Echo) */

    /*******************************************************************/

    var s; //

    s="\n\n\n"; //

    WScript.Echo(s); //

    /************* *********************************************/

    2.4. (VBScript)

    '*******************************************************************

    ' : Echo2.vbs

    ' : VBScript

    ' : (WScript.Echo)

    '*******************************************************************

    Option Explicit

    Dim s '

    '

    s=""&vbCrLf&""&vbCrLf&""&vbCrLf&""

    WScript.Echo s '

    '************* *********************************************

    Write WriteLine WScript.StdOut

    , ,

    WScript.StdOut
    ( 2.5 2.6). , ,
    StdOut
    , cscript.exe. , , StdOut1.js wscript.exe, (. 2.4).

    . 2.4. ,

    StdOut


    2.5. (JScript)

    /*******************************************************************/

    /* : StdOut1.js */

    /* : JScript */

    /* : StdOut.Write 蠠 */

    /* StdOut.WriteLine */

    /*******************************************************************/

    var n; //

    n=1+2;

    //

    WScript.StdOut.Write(" ");

    //

    WScript.StdOut.WriteLine("StdOut.WriteLine");

    //

    WScript.StdOut.WriteLine(", 1+2="+n);

    /************* *********************************************/

    2.6. (VBScript)

    '*******************************************************************

    ' : StdOut1.vbs

    ' : VBScript

    ' : StdOut.Write StdOut.WriteLine

    '*******************************************************************

    Option Explicit

    Dim n '

    n=1+2

    '

    WScript.StdOut.Write " "

    '

    WScript.StdOut.WriteLine "StdOut.WriteLine"

    Windows , , Windows- (CP 1251). Windows

    WScript.StdOut
    DOS- (OEM 866).

    WScript.Echo
    ,
    WriteLine
    , ( 2.7 2.8).

    2.7.
    StdOut
    (JScript)

    /*******************************************************************/

    /* : StdOu2.js */

    /* : JScript */

    /* : (StdOut.WriteLine) */

    /*******************************************************************/

    var s; //

    s="\n\n\n"; //

    WScript.StdOut.WriteLine(s); //

    /************* *********************************************/

    2.8.
    StdOut
    (VBScript)

    '*******************************************************************

    ' : StdOut2.vbs

    ' : VBScript

    ' : (StdOut.WriteLine)

    '*******************************************************************

    Option Explicit

    Dim s '

    '

    s=""&vbCrLf&""&vbCrLf&""&vbCrLf&""

    WScript.StdOut.WriteLine s '

    '************* *********************************************

    WScript.StdOut
    Write
    WriteLine
    ( 2.9 2.10).

    r 2.9.
    StdOut
    (JScript)

    /*******************************************************************/

    /* : StdOut3.js */

    /* : JScript */

    /* : StdOut.WriteLine */

    /*******************************************************************/

    var n,StdOut; //

    n=1+2;

    StdOut=WScript.StdOut; // StdOut

    // StdOut

    StdOut.WriteLine(" StdOut.WriteLine() ...");

    StdOut.WriteLine("1+2="+n);

    /************* *********************************************/

    r 2.10. StdOut (VBScript)

    '*******************************************************************

    ' : StdOut3.vbs

    ' : JScript

    ' : StdOut.WriteLine

    '*******************************************************************

    Option Explicit

    Dim n,StdOut '

    n=1+2

    Set StdOut=WScript.StdOut ' StdOut

    ' StdOut

    StdOut.WriteLine " StdOut.WriteLine() ..."

    StdOut.WriteLine "1+2=" & n

    '************* *********************************************

    MsgBox VBScript

    VBScript

    MsgBox
    , ; (. 2.5).

    . 2.5. ,

    MsgBox


    , , 2.11.

    JScript

    MsgBox
    .

    2.11. MsgBox (VBScript)

    '*******************************************************************

    ' : MsgBox.vbs

    ' : VBScript

    ' : MsgBox

    '*******************************************************************

    Dim Res,Text,Title '

    Text=" " & vbCrLf & " VBScript"

    Title=""

    '

    Res=MsgBox(Text,vbOkCancel+vbInformation+vbDefaultButton2,Title)

    ' ,

    If Res=vbOk Then

    MsgBox " OK"

    Else

    MsgBox " "

    End If

    '************* *********************************************

    MsgBox
    1. ,
    MsgBox
    , (
    vbOk
    vbCancel
    ). ,
    MsgBox
    , , .. ( OK, , , , , ).

    Popup WshShell

    Popup
    ( 1) ,
    MsgBox
    , VBScript-, JScript- ( 2.12 2.13).

    2.12.
    Popup
    (JScript)

    /*******************************************************************/

    /* : Popup.js */

    /* : JScript */

    /* : WshShell.Popup */

    /*******************************************************************/

    var WshShell,Res,Text,Title; //

    //

    var vbOkCancel=1,vbOk=1;

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    Text=" \n WScript";

    Title=""

    //

    Res=WshShell.Popup(Text,0,Title,vbOkCancel);

    // ,

    if (Res==vbOk) WshShell.Popup(" OK");

    else WshShell.Popup(" ");

    /************* *********************************************/

    2.13.
    Popup
    (VBScript)

    '*******************************************************************

    ' : Popup.vbs

    ' : VBcript

    ' : WshShell.Popup

    '*******************************************************************

    Option Explicit

    Dim WshShell,Res,Text,Title '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Text=" " & vbCrLf & " WScript"

    Title=""

    '

    Res=WshShell.Popup(Text,0,Title,vbOkCancel)

    ' ,

    If (Res=vbOk) Then

    WshShell.Popup " OK"

    Else

    WshShell.Popup " "

    End If

    '************* *********************************************

    Popup
    MsgBox
    nSecToWait
    , ( ), . , , - .

    . -: cscript.exe

    StdOut
    , wscript.exe
    InputBox
    VBScript.

    WScript.StdIn.ReadLine
    , <Enter>.

    ,

    WScript.StdIn
    Windows ( , ) , . ,
    WScript.StdIn.ReadLine
    DOS-,
    WScript.StdOut.WriteLine
    WScript.Echo
    Windows- ( Windows
    WScript.StdOut.WriteLine
    DOS-). DOS- Windows-. , , JScript VBScript , .

    JScript DosToWin 2.14:

    function DosToWin(s) {

    var i,ss; //

    //, RusDict

    if (typeof(RusDict)=="undefined")

    // RusDict ,

    MakeRusDict();

    ss="";

    for (i=0;i<s.length;i++) { //

    if (RusDict.Exists(s.charAt(i))) //

    // i- Windows-

    ss+=RusDict.Item(s.charAt(i));

    else ss+=s.charAt(i);

    }

    return ss;

    }

    , : Windows-, .

    DosToWin
    Dictionary
    ( )
    RusDict
    .
    MakeRusDict
    """" , DOS-, , Windows-:

    function MakeRusDict() {

    // Dictionary

    RusDict = WScript.CreateObject("Scripting.Dictionary");

    // "" ( DOS-)-"" (

    //Window-)

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    }

    DosToWin
    VBScript- StdIn1.vbs ( 2.15) Windows-, ANSI- :

    Function DosToWin(s)

    Dim i,k,ss

    ss=""

    For i=1 To Len(s) '

    k = Asc(Mid(s,i,1)) ' ANSI- i-

    ' k

    ' Windows-

    If (128 <= k) And (k <= 175) Then

    k=k+64

    ElseIf (224 <= k) And (k <= 239) Then

    k=k+16

    ElseIf k = 240 Then

    k=168

    ElseIf k = 241 Then

    k=184

    End If

    ss=ss+Chr(k) '

    Next

    DosToWin=ss

    End Function

    ANSI- DOS- Windows-, .

    2.14.
    StdIn.ReadLine
    (JScript)

    /*******************************************************************/

    /* : StdIn1.js */

    /* : JScript */

    /* : StdIn.ReadLine */

    /*******************************************************************/

    var s,RusDict; //

    // Dictionary "-",

    //""- DOS-, ""- ,

    // Windows-

    function MakeRusDict() {

    // Dictionary

    RusDict = WScript.CreateObject("Scripting.Dictionary");

    // "" ( DOS-)-"" (

    //Window-)

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    }

    // DOS- Windows-

    function DosToWin(s) {

    var i,ss; //

    //, RusDict

    if (typeof(RusDict)=="undefined")

    // RusDict ,

    MakeRusDict();

    ss="";

    for (i=0;i<s.length;i++) { //

    if (RusDict.Exists(s.charAt(i))) //

    // i- Windows-

    ss+=RusDict.Item(s.charAt(i));

    else ss+=s.charAt(i);

    }

    return ss;

    }

    /************* *********************************************/

    //

    WScript.StdOut.Write(" : ");

    s = WScript.StdIn.ReadLine(); //

    WScript.StdOut.WriteBlankLines(1); //

    WScript.StdOut.Write(" : ");

    // Windows-

    //

    WScript.StdOut.WriteLine(DosToWin(s));

    /************* *********************************************/

    2.15. StdIn ReadLine (VBScript)

    '*******************************************************************

    ' : StdIn1.vbs

    ' : VBScript

    ' : StdIn.WriteLine

    '*******************************************************************

    ' DOS- Windows-

    Function DosToWin(s)

    Dim i,k,ss

    ss=""

    For i=1 To Len(s) '

    k = Asc(Mid(s,i,1)) ' ANSI- i-

    ' k

    ' Windows-

    If (128 <= k) And (k <= 175) Then

    k=k+64

    ElseIf (224 <= k) And (k <= 239) Then

    k=k+16

    ElseIf k = 240 Then

    k=168

    ElseIf k = 241 Then

    k=184

    End If

    ss=ss+Chr(k) '

    Next

    DosToWin=ss

    End Function

    '************* *********************************************

    Dim s

    '

    WScript.StdOut.Write " : "

    s = WScript.StdIn.ReadLine '

    WScript.StdOut.WriteBlankLines 1 '

    WScript.StdOut.Write " : "

    ' Windows-

    '

    WScript.StdOut.WriteLine DosToWin(s)

    '************* *********************************************


    WScript.StdIn.ReadAll
    , , <Ctrl>+<Z>. , . JScript
    split
    string
    , VBScript
    Split
    ( 2.16 2.17).

    2.16.
    StdIn.ReadAll
    (JScript)

    /*******************************************************************/

    /* : StdIn2.js */

    /* : JScript */

    /* : StdIn.ReadAll */

    /*******************************************************************/

    var RusDict;

    // Dictionary "-",

    //""- DOS-, ""- ,

    // Windows-

    function MakeRusDict() {

    // Dictionary

    RusDict = WScript.CreateObject("Scripting.Dictionary");

    // "" ( DOS-)-"" (

    //Window-)

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    RusDict.add("", ""); RusDict.add("", ""); RusDict.add("", "");

    }

    // DOS- Windows-

    function DosToWin(s) {

    var i,ss; //

    //, RusDict

    if (typeof(RusDict)=="undefined")

    // RusDict ,

    MakeRusDict();

    ss="";

    for (i=0;i<s.length;i++) { //

    if (RusDict.Exists(s.charAt(i))) //

    // i- Windows-

    ss+=RusDict.Item(s.charAt(i));

    else ss+=s.charAt(i);

    }

    return ss;

    }

    /************* *********************************************/

    var s,ArrS,i; //

    //

    WScript.StdOut.WriteLine(" :");

    s = WScript.StdIn.ReadAll(); //

    WScript.StdOut.WriteBlankLines(3); //

    ArrS=s.split("\n"); //

    WScript.StdOut.WriteLine(" : "+ArrS.length);

    for (i=1;i<=ArrS.length;i++)

    // Windows-

    //

    WScript.StdOut.WriteLine(i+": "+DosToWin(ArrS[i-1]));

    /************* *********************************************/

    2.17.
    StdIn.ReadAll
    (VBScript)

    '*******************************************************************

    ' : StdIn2.vbs

    ' : VBScript

    ' : StdIn.ReadAll

    '*******************************************************************

    Option Explicit

    ' DOS- Windows-

    Function DosToWin(s)

    Dim i,k,ss

    ss=""

    For i=1 To Len(s) '

    k = Asc(Mid(s,i,1)) ' ANSI- i-

    ' k

    ' Windows-

    If (128 <= k) And (k <= 175) Then

    k=k+64

    ElseIf (224 <= k) And (k <= 239) Then

    k=k+16

    ElseIf k = 240 Then

    k=168

    ElseIf k = 241 Then

    k=184

    End If

    ss=ss+Chr(k)

    Next

    DosToWin=ss '

    End Function

    '************* *********************************************

    Dim s,ArrS,i,ColStr '

    '

    WScript.StdOut.WriteLine " :"

    s = WScript.StdIn.ReadAll '

    WScript.StdOut.WriteBlankLines 3 '

    ArrS=Split(s,vbCrLf) '

    ColStr=UBound(ArrS)+1

    '

    WScript.StdOut.WriteLine " : " & ColStr

    For i=1 To ColStr

    ' Windows-

    '

    WScript.StdOut.WriteLine i & ": " & DosToWin(ArrS(i-1))

    Next

    '************* *********************************************/

    VBScript ,

    InputBox
    (. 2.6).

    . 2.6.


    ,

    InputBox
    , 2.18 ( InputBox . 1).

    2.18. InputBox (VBScript)

    '*******************************************************************

    ' : InpBox.vbs

    ' : VBScript

    ' : InputBox

    '*******************************************************************

    Option Explicit

    Dim s,s1 '

    s1="" & vbCrLf & " " & vbCrLf & " "

    '

    s=InputBox(s1," VBScript")

    '

    MsgBox " : " & s

    '************* *********************************************/

    , JScript, WSH , . XML-, 3, VBScript (

    InputBox
    ) JScript- ( 3.11).

    WSH

    WSH (, - ) , (, , ). WSH

    WScript
    :

    ? - (cscript.exe wscript.exe);

    ? , -;

    ? WSH;

    ? ;

    ? .

    , ,

    IsCScript
    ( JScript),
    true
    , cscript.exe ( ),
    false
    , wscript.exe ( ):

    function IsCScript() {

    // ,

    return (""== WScript.FullName.toLowerCase().charAt(WScript.FullName.length- 11));

    }

    ,

    IsCScript
    , - ("" cscript.exe "w" wscript.exe).

    , .. , ,

    CurrentDirectory
    WshShell
    .

    , , . ,

    WScript.ScriptFullName
    , ( ). JScript
    GetScriptDir
    :

    function GetScriptDir() {

    var ScriptDir;

    ScriptDir = WScript.ScriptFullName;

    ScriptDir = ScriptDir.substring(0, ScriptDir.lastIndexOf("\\"));

    return ScriptDir;

    }

    JScript (PropScript.js) VBScript (PropScript.vbs), WSH , 2.19 2.20 ; PropScript.js . 2.7.

    . 2.7. PropScript.js


    2.19. WSH (JScript)

    /*******************************************************************/

    /* : PropScript.js */

    /* : JScript */

    /* : */

    /*******************************************************************/

    // ,

    function IsCScript() {

    return ("c"== WScript.FullName.toLowerCase().charAt(WScript.FullName.length - 11));

    }

    // ,

    function GetScriptDir() {

    var ScriptDir;

    ScriptDir = WScript.ScriptFullName;

    ScriptDir = ScriptDir.substring(0, ScriptDir.lastIndexOf("\\"));

    return ScriptDir;

    }

    /******************* **********************************/

    var WshShell,s; //

    // WshShell

    WshShell=WScript.CreateObject("WScript.Shell");

    s=" :\n\n";

    //,

    if (IsCScript()) s+=" \n";

    else s+=" \n";

    //

    s+=" : "+WScript.FullName+"\n";

    s+=" : "+WScript.Path+"\n";

    s+=" WSH: "+WScript.Version+"\n\n";

    s+=" : "+ WshShell.CurrentDirectory+"\n";

    s+=" : "+WScript.ScriptFullName+"\n";

    s+=" : "+GetScriptDir()+"\n";

    s+=" : "+WScript.ScriptName+"\n";

    WScript.Echo(s); //

    /************* *********************************************/

    2.20. WSH (VBScript)

    '*******************************************************************

    ' : PropScript.vbs

    ' : VBScript

    ' :

    '*******************************************************************

    Option Explicit

    ' ,

    Function IsCScript()

    IsCScript=("c"=Mid(LCase(WScript.FullName),Len(WScript.FullName)-10,1))

    End Function

    ' ,

    Function GetScriptDir()

    Dim ScriptDir

    ScriptDir = WScript.ScriptFullName

    ScriptDir = Left(ScriptDir, InstrRev(ScriptDir,"\")-1)

    GetScriptDir=ScriptDir

    End Function

    '******************* **********************************/

    Dim WshShell,s '

    ' WshShell

    Set WshShell=WScript.CreateObject("WScript.Shell")

    s=" :" & vbCrLf & vbCrLf

    ' ,

    If IsCScript() Then

    s=s & " " & vbCrLf

    Else

    s=s & " " & vbCrLf

    End If

    '

    s=s & " : " & WScript.FullName & vbCrLf

    s=s & " : " & WScript.Path & vbCrLf

    s=s & " WSH: " & WScript.Version & vbCrLf & vbCrLf

    s=s & " : "+ WshShell.CurrentDirectory & vbCrLf

    s=s & " : " & WScript.ScriptFullName & vbCrLf

    s=s & " : " & GetScriptDir() & vbCrLf

    s=s & " : " & WScript.ScriptName & vbCrLf

    WScript.Echo s '

    '************* *********************************************

    , , , . , : "_:".

    , .

    ,

    cscript Example.js /:" " /:30

    cscript Example.js /:30 /:" "

    Example.js : "" " " "" "30". :

    cscript Example.js " " 30

    .

    WSH -:

    ?

    WshArguments
    ( , , );

    ?

    WshNamed
    ( );

    ?

    WshUnnamed
    ( ).

    XML-

    <runtime>
    ,
    <named>
    <unnamed>
    (. 3).

    , , -

    WshArguments
    ;
    Arguments
    WScript
    . JScript:

    var objArgs=WScript.Arguments;

    WshNamed
    WshUnnamed
    Named
    Unnamed
    WshArguments
    . :

    var objNamedArgs=objArgs.Named;

    var objUnnamedArgs=objArgs.Unnamed;

    WshArguments
    ,
    WshNamed
    WshUnnamed
    1. , , , Windows.

    2.21 2.22 JScript VBScript, , , . , , . 2.8.

    . 2.8. Args.js


    2.21. (JScript)

    /********************************************************************/

    /* : Args.js */

    /* : JScript */

    /* : */

    /********************************************************************/

    var

    i,objArgs,s,objNamedArgs,objUnnamedArgs; //

    objArgs = WScript.Arguments; // WshArguments

    //

    s=" : "+objArgs.Count()+"\n";

    for (i=0; i<=objArgs.Count()-1; i++)

    s+=objArgs(i)+"\n"; //

    objUnnamedArgs=objArgs.Unnamed; // WshUnnamed

    //

    s+="\n : "+objUnnamedArgs.length+"\n";

    for (i=0; i<=objUnnamedArgs.length-1; i++)

    //

    s+=objUnnamedArgs(i)+"\n";

    objNamedArgs=objArgs.Named; // WshNamed

    //

    s+="\n : "+objNamedArgs.length+"\n";

    //, /:

    if (objNamedArgs.Exists("")) s+=objNamedArgs("")+"\n";

    //, /Comp:

    if (objNamedArgs.Exists("Comp")) s+=objNamedArgs("Comp")+"\n";

    WScript.Echo(s); //

    /************* *********************************************/

    2.22. (VBScript)

    '********************************************************************

    ' : Args.vbs

    ' : VBScript

    ' :

    '********************************************************************

    Option Explicit

    Dim i,Arg,objArgs,s,objNamedArgs,objUnnamedArgs '

    Set objArgs = WScript.Arguments ' WshArguments

    '

    s=" : " & objArgs.Count() & vbCrLf

    For Each Arg In objArgs

    s=s & Arg & vbCrLf '

    Next

    Set objUnnamedArgs=objArgs.Unnamed ' WshUnnamed

    '

    s=s & vbCrLf & " : " & objUnnamedArgs.length & vbCrLf

    For Each Arg In objUnnamedArgs

    '

    s=s & Arg & vbCrLf

    Next

    Set objNamedArgs=objArgs.Named ' WshNamed

    '

    s=s & vbCrLf & " : " & objNamedArgs.Length & vbCrLf

    ' , /:

    If objNamedArgs.Exists("") Then

    s=s & objNamedArgs("") & vbCrLf

    End If

    ' , /Comp:

    If objNamedArgs.Exists("Comp") Then

    s=s & objNamedArgs("Comp") & vbCrLf

    End If

    WScript.Echo s '

    '************* *********************************************

    ( , ).

    Windows .

    WSH

    Quit
    WScript
    . 2.23 2.24 , , (. 2.9): OK 1, 0.

    . 2.9. , Quit.js


    2.23. (JScript)

    /*******************************************************************/

    /* : Quit.js */

    /* : JScript */

    /* : */

    /*******************************************************************/

    var WshShell,Res,Text,Title; //

    var vbOkCancel=1,vbOk=1; //

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    Text=" ";

    Title=" ";

    //

    Res=WshShell.Popup(Text,0,Title,vbOkCancel);

    if (Res==vbOk) WScript.Quit(1);

    else WScript.Quit(0);

    /************* *********************************************/

    r 2.24. (VBScript)

    '*******************************************************************

    ' : Quit.vbs

    ' : VBScript

    ' :

    '*******************************************************************

    Option Explicit

    Dim WshShell,Res,Text,Title '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Text=" "

    Title=" "

    '

    Res=WshShell.Popup(Text,0,Title,vbOkCancel)

    If Res=1 Then

    WScript.Quit 1

    Else

    WScript.Quit 0

    End If

    '************* *********************************************

    ,

    IF ERRORLEVEL
    .

    - 2.25. Quit.js

    START
    /WAIT
    , , - Quit.js. , p 1 ( OK),
    :Ok
    ECHO
    .

    BAT- DOS-.

    Quit.js 0 ( ),

    ECHO Quit.js

    2.25. Quit.js (Check.bat)

    @ OFF

    REM **************************************************************

    REM : check.bat

    REM : BAT-

    REM : DOS

    REM : Quit.js

    REM **************************************************************

    @O OFF

    ECHO Quit.js...

    START /W Quit.js

    REM Quit.js

    IF ERRORLEVEL 1 GOTO :Ok

    ECHO Quit.js

    GOTO :end

    :Ok

    ECHO Quit.js Ok

    :end

    ( Microsoft Word)

    , "" , .. - . , :

    ?

    CreateObject
    WScript
    ( WSH);

    ?

    new ActiveXObject
    ( JScript);

    ?

    CreateObject
    ( VBScript).

    (ProgID), . JScript:

    var WA=WScript.CreateObject("Word.Application");

    VBScript:

    Set WA=WScript.CreateObject("Word.Application")

    ProgID (type library) , tlb, ( , -, , ). ProgID , , .

    CreateObject
    , ProgID . , . ; , , , ( ).

    , Microsoft Word, ( 2.26 2.27).

    Microsoft Word 9.

    Word.Application
    , Microsoft Word:

    WA=WScript.CreateObject("Word.Application");

    , WD

    Document
    :

    WD=WA.Documents.Add();

    ,

    Sel
    Selection
    , , :

    Sel=WA.Selection;

    PrintInWord.js PrintInWord.vbs Word (. 2.10),

    PrintOut
    Document
    :

    WD.PrintOut();

    . 2.10. PrintInWord.js


    2.26. Microsoft Word (JScript)

    /*******************************************************************/

    /* : PrintInWord.js */

    /* : JScript */

    /* : ࠠ */

    /* (Microsoft Word) */

    /*******************************************************************/

    var WA,WD,Sel; //

    // -- Microsoft Word

    WA=WScript.CreateObject("Word.Application");

    //

    //WA=new ActiveXObject("Word.Application");

    WD=WA.Documents.Add(); // ( Document)

    WA.Visible=true; // Word

    Sel=WA.Selection; // Selection

    Sel.Font.Size=14; //

    Sel.ParagraphFormat.Alignment=1; //

    Sel.Font.Bold=true; //

    Sel.TypeText("!\n"); //

    Sel.Font.Bold=false; //

    Sel.ParagraphFormat.Alignment=0; //

    //

    Sel.TypeText(" WSH.");

    WD.PrintOut(); //

    /************* *********************************************/

    r 2.27. irsft Word (VBScript)

    '*******************************************************************

    ' : PrintInWord.vbs

    ' : VBScript

    ' :

    ' (Microsoft Word)

    '*******************************************************************

    Option Explicit

    Dim WA,WD,Sel '

    ' -- Microsoft Word

    Set WA=WScript.CreateObject("Word.Application")

    '

    ' Set WA=CreateObject("Word.Application")

    Set WD=WA.Documents.Add ' ( Document)

    WA.Visible=true ' Word

    Set Sel=WA.Selection ' Selection

    Sel.Font.Size=14 '

    Sel.ParagraphFormat.Alignment=1 '

    Sel.Font.Bold=true '

    Sel.TypeText "!" & vbCrLf '

    Sel.Font.Bold=false '

    Sel.ParagraphFormat.Alignment=0 '

    '

    Sel.TypeText " WSH."

    WD.PrintOut '

    '************* *********************************************

    .

    Windows

    WSH

    Run
    Exec
    WshShell
    .

    Run
    ( , ). , JScript-:

    var WshShell = WScript.CreateObject("WScript.Shell");

    WshShell.Run("notepad", 3);

    (notepad.exe) ( ) (

    Run
    . 1.13).

    Run
    , (
    AppActivate
    ), .

    Windows

    Exec
    . , ,
    WshScriptExec
    .

    :

    var WshShell = WScript.CreateObject("WScript.Shell");

    var theNotepad = WshShell.Exec("calc");

    ,

    Run
    , .

    WshScriptExec
    Status
    Status
    0, ,
    Status
    1, . ,
    Terminate
    , ,
    WshScriptExec
    .

    2.28 JScript, Exec (notepad.exe);

    WshScriptExec
    theNotepad
    :

    theNotepad = WshShell.Exec("notepad");

    1 ( , ), (. 2.11):

    WScript.Sleep(1000);

    Text=" (Status="+theNotepad.Status+")\n ?";

    Title="";

    Res=WshShell.Popup(Text, 0, Title, vbQuestion+vbYesNo);

    . 2.11. , ExecWinApp.js


    Terminate:

    if (Res==vbYes) {

    theNotepad.Terminate();

    WScript.Sleep(100);

    WScript.Echo(" (Status="+theNotepad.Status+")");

    }

    2.28. (JScript)

    /*******************************************************************/

    /* : ExecWinApp.js */

    /* : JScript */

    /* : ( WshScriptExec) */

    /*******************************************************************/

    var WshShell,theNotepad,Res,Text,Title; //

    //

    var vbYesNo=4,vbQuestion=32,vbYes=6,vbNo=7;

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    WScript.Echo(" ");

    // ( WshScriptExec)

    theNotepad = WshShell.Exec("notepad");

    WScript.Sleep(1000); //

    Text=" (Status="+theNotepad.Status+")\n ?";

    Title="";

    //

    Res=WshShell.Popup(Text,0,Title,vbQuestion+vbYesNo);

    //,

    if (Res==vbYes) {

    theNotepad.Terminate(); //

    // ,

    //

    WScript.Sleep(100);

    WScript.Echo(" (Status="+theNotepad.Status+")");

    }

    /************* *********************************************/

    VBScript 2.29.

    r 2.29. (VBScript)

    '*******************************************************************

    ' : ExecWinApp.vbs

    ' : VBScript

    ' : ( WshScriptExec)

    '*******************************************************************

    Option Explicit

    Dim WshShell,theNotepad,Res,Text,Title '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    WScript.Echo " "

    ' ( WshScriptExec)

    Set theNotepad = WshShell.Exec("notepad")

    WScript.Sleep 500 '

    Text=" (Status=" & theNotepad.Status & ")" & vbCrLf _

    & " ?"

    Title=""

    '

    Res=WshShell.Popup(Text,0,Title,vbQuestion+vbYesNo)

    ' ,

    If Res=vbYes Then

    theNotepad.Terminate '

    ' ,

    '

    WScript.Sleep 100

    WScript.Echo " (Status=" & theNotepad.Status & ")"

    End If

    '************* *********************************************/

    ,

    AppActivate
    WshScript
    . , (PID) , . PID,
    ProcessID
    WshScriptExec
    , .
    AppActivate
    :

    ? ;

    ? ;

    ?

    AppActivate
    , .

    , Windows, .

    SendKeys
    WshShell
    ( 1).

    SendKeys
    , .

    Run&ExecWinApp.js ( 2.30), (calc.exe),

    SendKeys
    <1>, <+>, <2> <Enter>:

    theCalculator = WshShell.Exec("calc");

    WScript.Sleep(1000);

    WshShell.AppActivate(theCalculator.ProcessID);

    WshShell.SendKeys("1{+}");

    WshShell.SendKeys("2");

    WshShell.SendKeys("~"); // <Enter>

    1 , :

    WScript.Sleep(1000);

    ( "3") "" <Ctrl>+<C>:

    WshShell.SendKeys ("^c");

    , :

    WScript.Echo(" ");

    . , AppActivate, PID :

    WshShell.AppActivate(theCalculator.ProcessID);

    , <Alt>+<F4>:

    WshShell.SendKeys("%{F4}");

    (notepad.exe) ( <Ctrl>+<V>):

    WshShell.Run("notepad");

    WScript.Sleep(1000);

    WshShell.AppActivate("notepad");

    WshShell.SendKeys("l{+}2=");

    WshShell.SendKeys("^v");

    WshShell.SendKeys(" {(}{)} Calculator");

    , . 2.12.

    . 2.12. Run&ExecWinApp.js


    2.30. (JScript)

    /*******************************************************************/

    /* : Run&ExecWinApp.js */

    /* : JScript */

    /* : 蠠 */

    /*******************************************************************/

    var WshShell, theCalculator; //

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    WScript.Echo(" \n 1+2");

    // WshScript ( )

    theCalculator = WshShell.Exec("calc");

    // , ,

    //

    WScript.Sleep(1000);

    //

    WshShell.AppActivate(theCalculator.ProcessID);

    //

    WshShell.SendKeys("1{+}");

    WshShell.SendKeys("2");

    WshShell.SendKeys("~"); // <Enter>

    WScript.Sleep(1000);

    // Windows (<Ctrl>+C)

    WshShell.SendKeys("^c");

    // ( )

    WScript.Echo(" ");

    //

    WshShell.AppActivate(theCalculator.ProcessID);

    // (<Alt>+<F4>)

    WshShell.SendKeys("%{F4}");

    WScript.Echo(" ");

    WshShell.Run("notepad"); //

    // , ,

    //

    WScript.Sleep(1000);

    WshShell.AppActivate("notepad"); //

    //

    WshShell.SendKeys("1{+}2=");

    // Windows (<Ctrl>+V)

    WshShell.SendKeys("^v");

    //

    WshShell.SendKeys(" {(}c{)} Calculator");

    /************* *********************************************/

    , VBScript-, 2.31.

    2.31. (VBScript)

    '*******************************************************************

    ' : Run&ExecWinApp.vbs

    ' : VBScript

    ' :

    '*******************************************************************

    Option Explicit

    Dim WshShell, theCalculator '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    WScript.Echo(" " & vbCrLf & " 1+2")

    ' WshScript ( )

    Set theCalculator = WshShell.Exec("calc")

    ' , ,

    '

    WScript.Sleep 500

    '

    WshShell.AppActivate theCalculator.ProcessID

    '

    WshShell.SendKeys "1{+}"

    WshShell.SendKeys "2"

    WshShell.SendKeys "~" ' <Enter>

    WScript.Sleep 500

    ' Windows (<Ctrl>+C)

    WshShell.SendKeys "^c"

    ' ( )

    WScript.Echo " "

    '

    WshShell.AppActivate theCalculator.ProcessID

    ' (<Alt>+<F4>)

    WshShell.SendKeys "%{F4}"

    WScript.Echo " "

    WshShell.Run "notepad" '

    ' , ,

    '

    WScript.Sleep 1000

    WshShell.AppActivate "notepad" '

    '

    WshShell.SendKeys "1{+}2="

    ' Windows (<Ctrl>+V)

    WshShell.SendKeys "^v"

    '

    WshShell.SendKeys " {(}c{)} Calculator"

    '************* *********************************************

    DOS

    , .. , ( ) DOS

    Run
    WshShell
    . , (
    Run
    true
    ). JScript VBScript 2.32 2.33 .

    2.32. (JScript)

    /*******************************************************************/

    /* : RunConApp.js */

    /* : JScript */

    /* : 蠠 */

    /* ࠠ */

    /*******************************************************************/

    var WshShell, Code; //

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    // xcopy "/?"

    Code=WshShell.Run("xcopy /?",1,true);

    //

    WScript.Echo(" : ", Code);

    /************* *********************************************/

    r 2.33. (VBSript)

    '*******************************************************************

    ' : RunConApp.vbs

    ' : VBScript

    ' :

    '

    '*******************************************************************

    Option Explicit

    Dim WshShell, Code '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    ' xcopy "/?"

    Code=WshShell.Run("xcopy /?",1,true)

    '

    WScript.Echo " : ", Code

    '************* *********************************************/

    DOS ( Windows NT/2000/XP cmd.exe, Windows9 command.com) . cmd.exe,

    COMSPEC
    .

    "%" (,

    %COMSPEC%
    ).

    2.34 2.35 JScript VBScript,

    COPY /?
    ( )
    DIR %WINDIR%
    ( Windows).

    ,

    COPY /?
    , , .. /k, , DIR %WINDIR%, windir.txt, , ..
    /
    .

    2.34. (JScript)

    /*******************************************************************/

    /* : RunDOSCom.js */

    /* : JScript */

    /* : DOS */

    /*******************************************************************/

    var WshShell, Code; //

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    // COPY

    WshShell.Run("%COMSPEC% /k copy /?",1);

    // DIR

    WshShell.Run("%COMSPEC% /c dir %WINDIR% > windir.txt",1);

    /************* *********************************************/

    2.35. (VBScript)

    '*******************************************************************

    ' : RunDOSCom.vbs

    ' : VBScript

    ' : DOS

    '*******************************************************************

    Option Explicit

    Dim WshShell, Code '

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    ' COPY

    WshShell.Run "%COMSPEC% /k copy /?",1

    ' DIR

    WshShell.Run "%COMSPEC% /c dir %WINDIR% > windir.txt",1

    '************* *********************************************/

    DOS,

    DOS , .. , -. , , , ( DOS, ,

    DIR | MORE
    ). , ; , WSH .

    ExecConApp.js ( 2.36), (. 2.13).

    . 2.13. ExecConApp.js


    , ,

    DIR /B
    (. 2.14).

    ,

    DIR
    /B
    :

    ObjExec=WshShell.Exec("%COMSPEC% / dir /b");

    , . ReadAll, , StdOut ObjExec s:

    IsBreak=false;

    for (;;) { //

    //, DIR

    if (!ObjExec.StdOut.AtEndOfStream)

    // DIR

    s+=ObjExec.StdOut.ReadAll();

    if (IsBreak) break; //

    if (ObjExec.Status==1) //, DIR

    IsBreak=true;

    else WScript.Sleep(100); // 0,1

    }

    . 2.14.

    DIR /B


    ,

    DIR
    , ..
    Status
    ObjExec
    1,
    WScript.Sleep
    0,1 .

    DIR
    (
    ObjExec.StdOut.AtEndOfStream
    true
    ), s :

    ArrS=s.split("\n");

    ,

    ArrS
    :

    ColFiles=ArrS.length-1;

    :

    WScript.StdOut.WriteLine(" : "+ColFiles);

    for (i=0;i<=ColFiles-1; i++ )

    WScript.StdOut.WriteLine(ArrS[i]); //

    DOS-, Windows ( JScript VBScript 2.14 2.15).

    2.36. (JScript)

    /*******************************************************************/

    /* : ExecConApp.js */

    /* : JScript */

    /* : */

    /*******************************************************************/

    //

    var ObjExec,WshShell,s,IsBreak,ArrS,ColStr,ColFiles,i;

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    // DIR

    ObjExec=WshShell.Exec("%COMSPEC% /c dir /b");

    s="";

    IsBreak=false;

    for (;;) { //

    //, DIR

    if (!ObjExec.StdOut.AtEndOfStream)

    // DIR

    s+=ObjExec.StdOut.ReadAll();

    if (IsBreak) break; //

    if (ObjExec.Status==1) //, DIR

    IsBreak=true;

    else WScript.Sleep(100); // 0,1

    }

    ArrS=s.split("\n"); //

    ColFiles=ArrS.length-1; //

    WScript.StdOut.WriteLine(" : "+ColFiles);

    for (i=0;i<=ColFiles-1;i++)

    WScript.StdOut.WriteLine(ArrS[i]); //

    /************* *********************************************/

    VBScript 2.37.

    2.37. (VBScript)

    '*******************************************************************

    ' : ExecConApp.vbs

    ' : VbScript

    ' :

    '*******************************************************************

    Option Explicit

    '

    Dim ObjExec,WshShell,s,IsBreak,ArrS,ColStr,ColFiles,i

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    ' DIR

    Set ObjExec=WshShell.Exec("%COMSPEC% /c dir /b")

    s=""

    IsBreak=False

    Do While True '

    ' , DIR

    If (Not ObjExec.StdOut.AtEndOfStream) Then

    ' DIR

    s=s+ObjExec.StdOut.ReadAll

    End If

    If IsBreak Then

    Exit Do '

    End If

    ' , DIR

    If ObjExec.Status=1 Then

    IsBreak=True

    Else

    WScript.Sleep 100 ' 0,1

    End If

    Loop

    ArrS=Split(s,vbCrLf) '

    ColFiles=UBound(ArrS) '

    WScript.StdOut.WriteLine " : " & ColFiles

    For i=0 To ColFiles-1

    WScript.StdOut.WriteLine ArrS(i) '

    Next

    '************* *********************************************

    Windows

    Windows (, (Desktop) (Start)), .

    SpecialFolders
    WshShell
    WshSpecialFolders
    , , , ( 1
    WshSpecialFolders
    ).

    2.38 2.39 JScript VBScript , (. 2.15).

    . 2.15. Windows


    2.38. (JScript)

    /******************************************************************/

    /* : SpecFold1.js */

    /* : JScript */

    /* : Windows */

    /******************************************************************/

    var WshShell, WshFldrs, i, s; //

    // WshShell

    WshShell = WScript.CreateObject("Wscript.Shell");

    // WshSpecialFolders

    WshFldrs = WshShell.SpecialFolders;

    s=" :\n\n";

    // WshFldrs

    for (i=0;i<= WshFldrs.Count()-1;i++) {

    //

    s+=WshFldrs(i)+"\n";

    }

    WScript.Echo(s);

    /************* *********************************************/

    r 2.39. (VBScript)

    '*****************************************************************

    ' : SpecFold1.vbs

    ' : VBScript

    ' : Windows

    '*****************************************************************

    Option Explicit

    Dim WshShell, WshFldrs, SpecFldr, s '

    ' WshShell

    Set WshShell = WScript.CreateObject("Wscript.Shell")

    ' WshSpecialFolders

    Set WshFldrs = WshShell.SpecialFolders

    s=" :" & vbCrLf & vbCrLf

    ' WshFldrs

    For Each SpecFldr In WshFldrs

    '

    s=s & SpecFldr & vbCrLf

    Next

    WScript.Echo s

    '************* *********************************************/

    WshSpecialFolders
    . , SpecFold2.js ( 2.40) (Desktop), (Favorites) (Programs) (Run) . 2.16.

    . 2.16.


    2.40. (JScript)

    /******************************************************************/

    /* : SpecFold2.js */

    /* : JScript */

    /* : Windows */

    /******************************************************************/

    var WshShell, WshFldrs, s; //

    // WshShell

    WshShell = WScript.CreateObject("Wscript.Shell");

    // WshSpecialFolders

    WshFldrs = WshShell.SpecialFolders;

    //

    s=" :\n\n";

    s+="Desktop:\t"+WshFldrs("Desktop")+"\n";

    s+="Favorites:\t"+WshFldrs("Favorites")+"\n";

    s+="Programs:\t"+WshFldrs("Programs");

    WScript.Echo(s); //

    /************* *********************************************/

    VBScript 2.41.

    2.41. (VBScript)

    '******************************************************************

    ' : SpecFold2.vbs

    ' : VBScript

    ' : Windows

    '******************************************************************

    Option Explicit

    Dim WshShell, WshFldrs, s '

    ' WshShell

    Set WshShell = WScript.CreateObject("Wscript.Shell")

    ' WshSpecialFolders

    Set WshFldrs = WshShell.SpecialFolders

    '

    s=" :" & vbCrLf & vbCrLf

    s=s+"Desktop:"+WshFldrs("Desktop") & vbCrLf

    s=s+"Favorites:"+WshFldrs("Favorites") & vbCrLf

    s=s+"Programs:"+WshFldrs("Programs")

    WScript.Echo s '

    '************* *********************************************/

    ( , (Start) ..) , :

    1.

    WshSpecialFolders
    , .

    2.

    CreateShortcut
    WshShell
    WshShortcut
    (
    WshUrlShortcut
    ) .

    3.

    WshShortcut
    (
    WshUrlShortcut
    ).

    4. Save WshShortcut (WshUrlShortcut).

    WshShortcut
    (. 2.17):

    ? (Target);

    ? (Start in);

    ? (Shortcut key);

    ? (Run);

    ? (Comment).

    ,

    WshShortcut
    , .

    . 2.17. Windows


    , Windows ,

    WshShortcut
    (, , ).

    Shortcut.js ( 2.42), " .lnk" (notepad.exe), (Programs) , . ,

    Popup
    WshShell
    (. 2.18).

    . 2.18.


    . 2.10. " .lnk"


    Shell32.dll, System Windows ( Windows 95/98 System), <Ctrl>+<Alt>+<N> (. 2.19).

    2.42. (JScript)

    /*****************************************************************/

    /* : Shortcut.js */

    /* : JScript */

    /* : */

    /*****************************************************************/

    //

    var WshShell,MyShortcut,PathTarg,PathIcon,Res,PathShortcut;

    //

    var vbYesNo=4,vbQuestion=32,vbYes=6;

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    // ,

    Res=WshShell.Popup(" ?\n - \n - ",0,

    " ",vbQuestion+vbYesNo);

    if (Res==vbYes) //

    //

    PathShortcut = WshShell.SpecialFolders("Desktop");

    else

    //

    PathShortcut = WshShell.SpecialFolders("Programs");

    // -

    MyShortcut = WshShell.CreateShortcut(PathShortcut+"\\ .lnk");

    //

    PathTarg=WshShell.ExpandEnvironmentStrings("%windir%\\notepad.exe");

    MyShortcut.TargetPath = PathTarg;

    //

    MyShortcut.Hotkey = "CTRL+ALT+N";

    // SHELL32.dll

    PathIcon=

    WshShell.ExpandEnvironmentStrings("%windir%\\system32\\SHELL32.dll");

    MyShortcut.IconLocation = PathIcon+", 1";

    MyShortcut.WindowStyle=3; // ()

    MyShortcut.Save(); //

    WScript.Echo(" |");

    /************* *********************************************/

    VBScript 2.43.

    2.43. (VBScript)

    '*****************************************************************

    ' : Shortcut.vbs

    ' : JScript

    ' :

    '*****************************************************************

    Option Explicit

    '

    Dim WshShell,MyShortcut,PathTarg,PathIcon,Res,PathShortcut

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    ' ,

    Res=WshShell.Popup(" ?" & vbCrLf & " - " & vbCrLf & _

    " - ",0," ",vbQuestion+vbYesNo)

    If Res=vbYes Then '

    '

    PathShortcut = WshShell.SpecialFolders("Desktop")

    Else

    '

    PathShortcut = WshShell.SpecialFolders("Programs")

    End If

    ' -

    Set MyShortcut = WshShell.CreateShortcut(PathShortcut+"\ .lnk")

    '

    PathTarg=WshShell.ExpandEnvironmentStrings("%windir%\\notepad.exe")

    MyShortcut.TargetPath = PathTarg

    '

    MyShortcut.Hotkey = "CTRL+ALT+N"

    ' SHELL32.dll

    PathIcon = _

    WshShell.ExpandEnvironmentStrings("%windir%\system32\SHELL32.dll")

    MyShortcut.IconLocation = PathIcon & ", 1"

    MyShortcut.WindowStyle=3 ' ()

    MyShortcut.Save '

    WScript.Echo " |"

    '************* *********************************************

    Windows

    Windows , . , , . regedit.exe (. 2.20).

    . 2.20. regedit.exe


    WshShell
    WSH :

    ? (

    RegWrite
    );

    ? (

    RegWrite
    );

    ? (

    RegRead
    );

    ? (

    RegDelete
    ).

    Windows , .

    2.44 Registry.js,

    HKEY_CURRENT_USER
    , , .

    HKEY_CURRENT_USER
    ExampleKey
    ,
    ExampleValue
    "Value from WSH" (. 2.21).

    . 2.21. , Registry.js


    ExampleValue
    ExampleKey
    .

    2.44. (JScript)

    /********************************************************************/

    /* : Registry.js */

    /* : JScript */

    /* : 젠 */

    /********************************************************************/

    //

    var WshShell,Root,Key,Res,SValue,ValueName,SRegValue;

    //

    var vbYesNo=4,vbQuestion=32,vbInformation=64,vbYes=6,vbOkOnly=0;

    Root="HKEY_CURRENT_USER"; //

    Key="\\ExampleKey\\"; //

    ValueName="ExampleValue"; //

    SValue="Value from WSH"; //

    // WshShell

    WshShell=WScript.CreateObject("WScript.Shell");

    //

    Res=WshShell.Popup(" \n"+Root+Key+"?",0,

    " ",vbQuestion+vbYesNo);

    if (Res==vbYes) { //

    //

    WshShell.RegWrite(Root+Key,"");

    WshShell.Popup("\n"+Root+Key+" !",0,

    " ",vbInformation+vbOkOnly);

    }

    //

    Res=WshShell.Popup(" \n"+Root+Key+ValueName+"?",0,

    " ",vbQuestion+vbYesNo);

    if (Res==vbYes) { //

    //

    WshShell.RegWrite(Root+Key+ValueName,SValue,"REG_SZ");

    WshShell.Popup("\n"+Root+Key+ValueName+" !",0,

    " ",vbInformation+vbOkOnly);

    //

    SRegValue=WshShell.RegRead(Root+Key+ValueName);

    //

    WshShell.Popup(Root+Key+ValueName+"="+SRegValue,0,

    " ",vbInformation+vbOkOnly);

    }

    //

    Res=WshShell.Popup(" \n"+Root+Key+ValueName+"?",0,

    " ",vbQuestion+vbYesNo);

    if (Res==vbYes) { //

    //

    WshShell.RegDelete(Root+Key+ValueName);

    WshShell.Popup("\n"+Root+Key+ValueName+" !",0,

    " ",vbInformation+vbOkOnly);

    }

    //

    Res=WshShell.Popup(" \n"+Root+Key+"?",0,

    " ",vbQuestion+vbYesNo);

    if (Res==vbYes) { //

    //

    WshShell.RegDelete(Root+Key);

    WshShell.Popup("\n"+Root+Key+" !",0,

    " ",vbInformation+vbOkOnly);

    }

    /************* *********************************************/

    VBScript 2.45.

    r 2.45. (VBScript)

    '********************************************************************

    ' : Registry.vbs

    ' : VBScript

    ' :

    '********************************************************************

    Option Explicit

    '

    Dim WshShell,Root,Key,Res,SValue,ValueName,SRegValue

    Root="HKEY_CURRENT_USER" '

    Key="\ExampleKey\" '

    ValueName="ExampleValue" '

    SValue="Value from WSH" '

    ' WshShell

    Set WshShell=WScript.CreateObject("WScript.Shell")

    '

    Res=WshShell.Popup(" " & vbCrLf & Root & Key & "?",0,_

    " ",vbQuestion+vbYesNo)

    If Res=vbYes Then '

    '

    WshShell.RegWrite Root & Key, ""

    WshShell.Popup "" & vbCrLf & Root & Key & " !",0,_

    " ",vbInformation+vbOkOnly

    End If

    '

    Res=WshShell.Popup(" " & vbCrLf & Root & Key & _

    ValueName & "?",0," ",vbQuestion+vbYesNo)

    If Res=vbYes Then '

    '

    WshShell.RegWrite Root & Key & ValueName,SValue,"REG_SZ"

    WshShell.Popup "" & vbCrLf & Root & Key & _

    ValueName & " !",0," ",vbInformation+vbOkOnly

    '

    SRegValue=WshShell.RegRead(Root & Key & ValueName)

    '

    WshShell.Popup Root & Key & ValueName & "=" & SRegValue,0,_

    " ",vbInformation+vbOkOnly

    End If

    '

    Res=WshShell.Popup(" " & vbCrLf & Root & Key & _

    ValueName & "?",0," ",vbQuestion+vbYesNo)

    If Res=vbYes Then '

    '

    WshShell.RegDelete Root & Key & ValueName

    WshShell.Popup "" & vbCrLf & Root & Key & _

    ValueName & " !",0," ",vbInformation+vbOkOnly

    End If

    '

    Res=WshShell.Popup(" " & vbCrLf & Root & Key & _

    "?",0," ",vbQuestion+vbYesNo)

    If Res=vbYes Then '

    '

    WshShell.RegDelete Root & Key

    WshShell.Popup "" & vbCrLf & Root & Key & " !",0,_

    " ",vbInformation+vbOkOnly

    End If

    '************* *********************************************

    , ,

    WshNetwork
    . :

    ? , , ;

    ? , ;

    ? ;

    ? , .

    , , Windows ADSI Active Directory Service Interface WMI Windows Management Instrumentation.

    ,

    , ,

    WshNetwork
    :
    UserName
    ,
    Domain
    ComputerName
    . JScript VBScript, , 2.46 2.47.

    2.46. (JScript)

    /********************************************************************/

    /* : NetworkParam.js */

    /* : JScript */

    /* : 蠠 */

    /********************************************************************/

    var WshNetwork,s; //

    // WshNetwork

    WshNetwork = WScript.CreateObject("WScript.Network");

    s=" :\n\n";

    // ComputerName, UserName UserDomain

    s+=" : "+WshNetwork.ComputerName+"\n";

    s+=" : "+WshNetwork.UserName+"\n";

    s+=": "+WshNetwork.UserDomain;

    WScript.Echo(s);

    /************* *********************************************/

    2.47. (VBScript)

    '********************************************************************

    ' : NetworkParam.vbs

    ' : VBScript

    ' :

    '********************************************************************

    Option Explicit

    Dim WshNetwork,s,NetwDrives,i,NetwPrinters '

    ' WshNetwork

    Set WshNetwork = WScript.CreateObject("WScript.Network")

    s=" :" & vbCrLf & vbCrLf

    ' ComputerName, UserName UserDomain

    s=s & " : " & WshNetwork.ComputerName & vbCrLf

    s= s & " : " & WshNetwork.UserName & vbCrLf

    s= s & ": " & WshNetwork.UserDomain

    WScript.Echo s

    '************* *********************************************

    WshNetwork
    EnumNetworkDrives
    EnumPrinterConnections
    , , , , . : , , . .

    2.48 2.49 JScript VBScript , , , (. 2.22).

    . 2.22. ListNetworkResources.js


    2.48. (JScript)

    /********************************************************************/

    /* : ListNetworkResources.js */

    /* : JScript */

    /* : ( ) */

    /********************************************************************/

    var WshNetwork,s,NetwDrives,i,NetwPrinters; //

    // WshNetwork

    WshNetwork = WScript.CreateObject("WScript.Network");

    /***** ******/

    s=" :\n\n";

    //

    NetwDrives = WshNetwork.EnumNetworkDrives();

    i=0;

    while (i<=NetwDrives.Count()-2) { //

    // ,

    // - ..

    s+=NetwDrives(i)+" "+NetwDrives(i+1)+"\n";

    i=i+2;

    }

    WScript.Echo(s); //

    /****** ******/

    s=" :\n\n";

    //

    NetwPrinters = WshNetwork.EnumPrinterConnections();

    i=0;

    while (i<=NetwPrinters.Count()-2) { //

    // ,

    // - ..

    s+=NetwPrinters(i)+" "+NetwPrinters(i+1)+"\n";

    i=i+2;

    }

    WScript.Echo(s); //

    /************* *********************************************/

    2.49. (VBScript)

    '********************************************************************

    ' : ListNetworkResources.vbs

    ' : JScript

    ' : ( )

    '********************************************************************

    Option Explicit

    Dim WshNetwork,s,NetwDrives,i,NetwPrinters '

    ' WshNetwork

    Set WshNetwork = WScript.CreateObject("WScript.Network")

    '******** ⠠ *********

    s=" :" & vbCrLf & vbCrLf

    '

    Set NetwDrives = WshNetwork.EnumNetworkDrives()

    i=0

    While i<=NetwDrives.Count()-2 '

    ' ,

    ' - ..

    s=s & NetwDrives.Item(i) & " " & NetwDrives.Item(i+1) & vbCrLf

    i=i+2

    Wend

    WScript.Echo s '

    '******** ⠠ *******

    s=" :" & vbCrLf & vbCrLf

    '

    Set NetwPrinters = WshNetwork.EnumPrinterConnections()

    i=0

    While i<=NetwPrinters.Count()-2 '

    ' ,

    ' - ..

    s=s & NetwPrinters.Item(i) & " " & NetwPrinters.Item(i+1) & vbCrLf

    i=i+2

    Wend

    WScript.Echo s '

    '************* *********************************************

    ( ) . (, :, D: : ( ), F: K:, :). ( Windows), ( MS-DOS).

    Windows

    NET USE
    .

    JScript- MapResources.js ( 2.50), K: \\RS_NT_Server\d LPT1 \\104_Stepankova\HP.

    WshNetwork WshShell:

    WshNetwork = WScript.CreateObject("WScript.Network");

    WshShell = WScript.CreateObject("WScript.Shell");

    K:, , ( ). RemoveNetworkDrive:

    WshNetwork.RemoveNetworkDrive(Drive);

    ( Drive "K:"). (, K: ),

    RemoveNetworkDrive
    try
    trycatch
    JScript, :

    try {

    //

    WshNetwork.RemoveNetworkDrive(Drive);

    } catch (e) { //

    if (.number != 0) {

    //

    IsError=true;

    Mess=" "+Drive + "\n : "+

    .number+"\n: " + .description;

    WshShell.Popup(Mess, 0, " ", vbCritical);

    }

    }

    RemoveNetworkDrive
    catch
    , - (
    .number
    ,
    .description
    ); (. 2.23).

    . 2.23. , K:


    K: , (. 2.24):

    if (!IsError) { //

    Mess=" "+Drive+" ";

    WshShell.Popup(Mess, 0, " ", vbInformation);

    }

    . 2.24. K:


    trycatch
    :

    try {

    //

    WshNetwork.MapNetworkDrive(Drive, NetPath);

    } catch (e) {

    //

    if (e != 0) {

    //

    IsError=true;

    Mess=" " + Drive + " " + NetPath+

    "\n : "+.number + "\n: "+.description;

    WshShell.Popup(Mess, 0, " ", vbCritical);

    , , , , , , . 2.25.

    . 2.25. , K:


    (

    RemovePrinterConnection
    ), (
    AddPrinterConnection
    ) , , .

    2.50. (JScript)

    /********************************************************************/

    /* : MapResources.js */

    /* : JScript */

    /* : ⠠ */

    /********************************************************************/

    //

    var WshNetwork,WshShell,Drive,NetPath,Port,NetPrinter,Mess,IsError;

    //

    var vbCritical=16,vbInformation=64;

    Drive="K:"; //

    //NetPath="\\\\RS_NT_Server\\d"; //

    NetPath="\\\\RS_NT_Server\\d"; //

    Port="LPT1"; //

    //

    NetPrinter="\\\\104_Stepankova\\HP";

    // WshNetwork

    WshNetwork = WScript.CreateObject("WScript.Network");

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    /************* ***********************/

    IsError=false;

    try {

    //

    WshNetwork.RemoveNetworkDrive(Drive);

    } catch (e) { //

    if (e != 0) {

    //

    IsError=true;

    Mess=" "+Drive+"\n : "+

    e.number+"\n: "+e.description;

    WshShell.Popup(Mess,0," ",vbCritical);

    }

    }

    if (!IsError){

    //

    Mess=" "+Drive+" ";

    WshShell.Popup(Mess,0," ",vbInformation);

    }

    /************* ***********************/

    IsError=false;

    try {

    //

    WshNetwork.MapNetworkDrive(Drive,NetPath);

    } catch (e) {//

    if (e != 0) {

    //

    IsError=true;

    Mess=" " + Drive + " " + NetPath+

    "\n : "+e.number+"\n: "+e.description;

    WshShell.Popup(Mess,0," ",vbCritical);

    }

    }

    if (!IsError){

    //

    Mess=" "+Drive+" "+NetPath;

    WshShell.Popup(Mess,0," ",vbInformation);

    }

    /************* ***********************/

    IsError=false;

    try {

    //

    WshNetwork.RemovePrinterConnection(Port);

    } catch (e) {

    if (e != 0) { //

    //

    IsError=true;

    Mess=" "+Port+"\n : "+

    e.number+"\n: "+e.description;

    WshShell.Popup(Mess,0," ",vbCritical);

    }

    }

    if (!IsError){

    //

    Mess=" "+Port+" ";

    WshShell.Popup(Mess,0," ",vbInformation);

    }

    /***** *********/

    IsError=false;

    try {

    //

    WshNetwork.AddPrinterConnection(Port,NetPrinter);

    } catch (e) { //

    if (e != 0) {

    //

    IsError=true;

    Mess=" "+Port+ " "+NetPrinter+

    "\n : "+e.number+"\n: "+e.description;

    WshShell.Popup(Mess,0," ",vbCritical);

    }

    }

    if (!IsError){

    //

    Mess=" "+Port+" "+NetPrinter;

    WshShell.Popup(Mess,0," ",vbInformation);

    }

    /************* *********************************************/

    VBScript 2.51. . VBScript

    On Error Resume Next
    , .
    Err
    ,
    Number
    Description
    .

    2.51. (VBScript)

    '********************************************************************

    ' : MapResources.vbs

    ' : VBScript

    ' :

    '********************************************************************

    Option Explicit

    '

    Dim WshNetwork,Drive,NetPath,Port,NetPrinter

    Drive="K:" '

    NetPath="\\RS_NT_Server\d" '

    Port="LPT1" '

    '

    NetPrinter="\\104_Stepankova\HP"

    ' WshNetwork

    Set WshNetwork = WScript.CreateObject("WScript.Network")

    ' WshShell

    Set WshShell = WScript.CreateObject("WScript.Shell")

    On Error Resume Next '

    '************* ***********************

    '

    WshNetwork.RemoveNetworkDrive Drive

    If Err.Number<>0 Then

    Mess=" " & Drive & vbCrLf & _

    " : " & e.number & vbCrLf &+ _

    ": " & e.description

    WshShell.Popup Mess,0," ",vbCritical

    Else

    '

    Mess=" " & Drive & " "

    WshShell.Popup Mess,0," ",vbInformation

    End If

    '************* ***********************

    '

    WshNetwork.MapNetworkDrive Drive,NetPath

    If Err.Number<>0 Then

    Mess=" " & Drive & " " & NetPath &_

    " : " & e.number & ": " & e.description

    WshShell.Popup Mess,0," ",vbCritical

    Else

    '

    Mess=" " & Drive & " " & NetPath

    WshShell.Popup Mess,0," ",vbInformation

    End If

    '************* ***********************

    '

    WshNetwork.RemovePrinterConnection Port

    If Err.Number<>0 Then

    Mess=" " & Port & " : " &_

    e.number & ": " & e.description

    WshShell.Popup Mess,0," ",vbCritical

    Else

    '

    Mess=" " & Port & " "

    WshShell.Popup Mess,0," ",_

    vbInformation

    End If

    '***** *********

    '

    WshNetwork.AddPrinterConnection Port,NetPrinter

    If Err.Number<>0 Then

    Mess=" " & Port & " " & NetPrinter &_

    " : " & e.number & ": " & e.description

    WshShell.Popup Mess,0," ",vbCritical

    Else

    '

    Mess=" " & Port & " " & NetPrinter

    WshShell.Popup Mess,0," ",

    vbInformation

    End If

    '************* *********************************************

    .

    5.6 WSH , , ( ).

    WSH- (remote scripts). , . DCOM Distributed ( ) , .

    , , . WSH .

    -, Windows NT (SP 3)/Windows 2000/Windows ( Windows 95/98/ME ).

    -, , , , .

    -, ( ). 1 :

    HKLM\Software\Microsoft\Windows Script Host\Settings\Remote
    ()

    ( , ). 0, , .

    ,

    HKCU\Software\Microsoft\Windows Script Host\Settings\Remote
    ()

    1. 0, , .

    HKLM\Software\Microsoft\Windows Script Host\Settings\IgnoreUserSettings
    ()

    1, () (). () 0, WSH () ().

    Windows , wscript.exe :

    wscript.exe -regserver

    wscript.exe, ( ). ,

    WScript.Echo
    WshShell.Popup
    ( ).

    RemoteShortcut.js ( 2.52), AllUserDesktop ( ). , D:, \\Stand.

    2.52. (JScript)

    /*****************************************************************/

    /* : RemoteShortcut.js */

    /* : 堠 */

    /*****************************************************************/

    var WshShell,MyShortcut,PathTarg,PathShortcut;

    // WshShell

    WshShell = WScript.CreateObject("WScript.Shell");

    // "AllUsersDesktop" (

    // )

    PathShortcut = WshShell.SpecialFolders("AllUsersDesktop");

    // -

    MyShortcut = WshShell.CreateShortcut(PathShortcut+ "\\From Remote WSH.lnk");

    //

    PathTarg=WshShell.ExpandEnvironmentStrings("%windir%\\notepad.exe");

    MyShortcut.TargetPath = PathTarg;

    MyShortcut.Save(); //

    /************* *********************************************/

    RemoteShortcut.js \\Stand RunRemoteScript.js ( 2.53).

    WshController
    :

    Controller = WScript.CreateObject("WshController");

    WshRemote
    \\Stand, , D:\RemoteScript.js:

    RemScript = Controller.CreateScript("D:\\RemoteScript.js", "stand");

    Execute
    :

    RemScript.Execute();

    ,

    while
    Status
    WshRemote
    ( status, 2, , ):

    while (RemScript.Status != 2)

    //

    WScript.Sleep(100); // 0,1

    Sleep
    WScript
    , ( 2.53).

    2.53. (JScript)

    /********************************************************************/

    /* : RunRemoteScript.js */

    /* : JScript */

    /* : */

    /********************************************************************/

    var Controller, RemScript; //

    // WshController

    Controller = WScript.CreateObject("WshController");

    // ( WshRemote)

    RemScript = Controller.CreateScript("D:\\RemoteScript.js", "stand");

    RemScript.Execute(); //

    WScript.Echo(" ");

    while (RemScript.Status != 2)

    //

    WScript.Sleep(100); // 0,1

    WScript.Echo(" ");

    /************* *********************************************/

    2.54 RunRemoteScript.js VBScript.

    2.54. (VBScript)

    '********************************************************************

    ' : RunRemoteScript.vbs

    ' : VBScript

    ' :

    '********************************************************************

    Option Explicit

    Dim Controller, RemScript '

    ' WshController

    Set Controller = WScript.CreateObject("WshController")

    ' ( WshRemote)

    Set RemScript = Controller.CreateScript("D:\\RemoteScript.js", "stand")

    RemScript.Execute '

    WScript.Echo " "

    While RemScript.Status <> 2

    '

    WScript.Sleep 100 ' 0,1

    Wend

    WScript.Echo " "

    '************* *********************************************

    Status
    ,
    Start
    ( ),
    Error
    ( )
    End
    ( ) WshRemote; JScript VBScript 2.55 2.56.

    , ,

    ConnectObject
    , -:

    Controller = WScript.CreateObject("WshController");

    RemScript = Controller.CreateScript("D:\\RemoteScript.js ", "stand");

    WScript.ConnectObject(RemScript, "RemoteScript_");

    RemoteScript_Start
    ,
    RemoteScript_Error
    RemoteScript_End
    , .

    2.55.
    WshRemote
    (JScript)

    /**********************************************************************/

    /* : RemoteEvents.js */

    /* : JScript */

    /* : , */

    /* */

    /**********************************************************************/

    var Controller,RemScript,IsQuit; //

    // WshController

    Controller = WScript.CreateObject("WshController");

    // ( WshRemote)

    RemScript = Controller.CreateScript("D:\\RemoteScript.js ", "stand");

    // WshRemote

    WScript.ConnectObject(RemScript, "RemoteScript_");

    RemScript.Execute(); //

    IsQuit = false;

    while (!IsQuit) WScript.Sleep(100); // 0,1

    WScript.Quit(); //

    /*************** - ***********************/

    function RemoteScript_End() { // End

    WScript.Echo(" ");

    IsQuit = true;

    }

    function RemoteScript_Error() { // Error

    //

    WScript.Echo(" : " +

    RemScript.Error.Description);

    IsQuit = true;

    }

    function RemoteScript_Start() { // Start

    WScript.Echo(" ");

    }

    /************* *********************************************/

    2.56. WshRemote (VBScript)

    '********************************************************************

    ' : RemoteEvents.vbs

    ' : VBScript

    ' : ,

    '

    '********************************************************************

    Option Explicit

    Dim Controller,RemScript,IsQuit '

    ' WshController

    Set Controller = CreateObject("WshController")

    ' ( WshRemote)

    Set RemScript = Controller.CreateScript("D:\RemoteScript.js ", "stand")

    ' WshRemote

    WScript.ConnectObject RemScript, "RemoteScript_"

    RemScript.Execute '

    IsQuit = False

    While Not IsQuit

    WScript.Sleep 100 ' 0,1

    Wend

    WScript.Quit '

    '*************** - ***********************

    Function RemoteScript_End() ' End

    WScript.Echo " "

    IsQuit = True

    End Function

    Function RemoteScript_Error() ' Error

    '

    WScript.Echo " : " & _

    RemScript.Error.Description

    IsQuit = True

    End Function

    Function RemoteScript_Start() ' Start

    WScript.Echo " "

    End Function

    '************* *********************************************

    WshRemote
    Status
    . , .









    | | | |

    .