Thursday, May 18, 2023

Using Windows Script Files

 https://github.com/89luca89/distrobox

Run a Command as Administrator from the Run Box in Windows 10 or Windows 11



systeminfo > C:\temp\SystemID.txt

systeminfo |clip

wmic /output:C:\temp\InstalledPrograms.txt product get name,version

wmic cpu get name

wmic memorychip list full

wmic diskdrive list full

wmic baseboard list full

wmic cdrom list full

pause





Using Windows Script Files (.wsf)

#032009

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.

Additional Features

.wsf files support

You can

Include statements

Incorporate functions from VBScript or JScript files into your Windows Script Host project.

Multiple engines

Use more than one scripting language per file.

Type libraries

Add constants to your code.

Tools

Edit files with any XML editor.

Multiple jobs in one file

Store all of your code in a single location.

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 JScript 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
   </script>
</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;
} 

Multiple-Engine Support

Since one scripting language may not have all the functionality you need, Windows Script Host allows you to combine multiple languages in a single .wsf file. The following example shows a .wsf file that includes both VBScript and PerlScript code:

<job id="PERLandVBS">
   <script language="PerlScript">
      sub PerlHello {
         my $str = @_[0];
         $WScript->Echo($str);
      }
   </script>

   <script language="VBScript">
      WScript.Echo "Hello from VBScript"
      PerlHello "Hello from PERLScript"
   </script>
</job>

Type Library Support

In the following example, "MyComponent" was developed with Microsoft Visual Basic 5.0. "MyComponent" defines the constant MyError with the following statement.

Public Const MyError = "You are not using MyComponent correctly"

The type library is contained in mycomponent.lib, which is installed in C:\MyComponent.

<job id="IncludeExample">
   <reference progid="MyComponent.MyClass">
   <script language="VBScript">
      Dim MyVar
      Set MyVar = CreateObject("MyComponent.MyClass")
      Currentreturn = MyVar.MyMethod
      If Currentreturn = False then
         WScript.Echo MyError
      End If
   </script>
</job>

Tools Support

Since the .wsf file is in XML format, you can use any editor that supports XML to edit .wsf files. This includes text editors, such as Notepad.

Multiple Jobs in One File

Instead of keeping all your scripts in separate files, you can incorporate them all into one .wsf file and break them into several different jobs. You can then run each job separately using syntax similar to the following example, where "MyFirstJob" is the name of the job contained in the MyScripts.wsf file.

CScript //Job:MyFirstJob MyScripts.wsf

Change History

#

History

Reason

#032009

Fixed bug in example.

Customer feedback.

https://en.wikipedia.org/wiki/Windows_Script_File




3.7 V to 1.5 V convertor = 



1 x BC547
2 x 10 K Ohm
1 x 4,7 uF 50V


Earth - Neutral power for clock= 




220 V~  > 1.5 V= clock:




1PCS 450V 225K 2.2uF P20 Polypropylene Film Capacitor Pitch 20mm


EKIGA VoIP=

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AU]
"NoAutoUpdate"=dword:00000001


No comments:

Post a Comment

Beogradsko programiranje=