- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Creating Script Files in Visual Studio .NET
Creating Script Files Paint Data Matrix In .NET Using Barcode maker for ASP.NET Control to generate, create Data Matrix 2d barcode image in ASP.NET applications. www.OnBarcode.comMaking Barcode In VS .NET Using Barcode maker for ASP.NET Control to generate, create barcode image in ASP.NET applications. www.OnBarcode.comScript files can have two file extensions, and the script's file extension indicates which language the file contains. Use the .js extension for files that contain JScript. Use the .vbs extension for files that contain VBScript. Regardless, script files are nothing more than text files that contain the language's keywords, so you can use your favorite text editor, Notepad, to create them. When you save a script file, make sure you enclose the file's name in quotation marks or choose All Files from the Save As Type list so Notepad doesn't add the .txt extension to the file. Without going into detail about the object model, you access the registry through the Shell object. This object contains the methods you call to add, remove, and update values in the registry. You'll add one of the following statements to every script in which you want to access the registry. The first line shows you how to create the Shell object using VBScript, and the second shows you how to do it using JScript. Just to show you how easy it is to create a script, open Notepad, and type Listing 9 7. The JScript language is case sensitive, so type Listing 9 7 carefully. VBScript has the benefit of not being case sensitive. Save the file using the .js extension, and then double click the file to run it. You'll see a message from me. Because double clicking the script file runs it, you must right click the file and then click Edit to edit the file. Listing 9 7: Example.js Data Matrix 2d Barcode Printer In Visual C#.NET Using Barcode encoder for .NET Control to generate, create Data Matrix 2d barcode image in .NET applications. www.OnBarcode.comData Matrix ECC200 Generation In .NET Using Barcode maker for .NET Control to generate, create Data Matrix ECC200 image in .NET framework applications. www.OnBarcode.comvar WshShell = WScript.CreateObject("WScript.Shell"); WshShell.Popup("Hello from Jerry Honeycutt" ); Create Data Matrix In Visual Basic .NET Using Barcode generation for .NET Control to generate, create ECC200 image in VS .NET applications. www.OnBarcode.comPrinting UPC Symbol In Visual Studio .NET Using Barcode generator for ASP.NET Control to generate, create Universal Product Code version A image in ASP.NET applications. www.OnBarcode.comset WshShell = WScript.CreateObject("WScript.Shell") var WshShell = WScript.CreateObject("WScript.Shell"); Linear Encoder In .NET Using Barcode creator for ASP.NET Control to generate, create Linear Barcode image in ASP.NET applications. www.OnBarcode.comGenerating Code 128 Code Set C In VS .NET Using Barcode drawer for ASP.NET Control to generate, create Code 128 Code Set A image in ASP.NET applications. www.OnBarcode.comWhy write scripts when INF files are easier I usually write INF files to edit the registry. If I'm not using INF files, I write batch files and use Reg.exe. I like the simplicity of these methods. There are times when writing a script is the only suitable method, however. Writing a script is necessary in a number of cases. The first is when you must have a user interface. If you want to display settings to or collect settings from users, scripting is the best choice. Also, scripting is the only method that provides rather full access to Windows XP. For example, you can use a script to inventory the computer and dump the information to a text file on the network. You can use a script to configure users' computers using logic, if this then that, which isn't possible with the other methods. So if you're doing anything more complicated than just adding, changing, or removing values, you're going to end up writing scripts. I've seen some fairly complicated scripts. For example, one fellow I worked with wrote a script that searched the registry for services that Sysprep disabled, and then permanently removed them from the registry. This is a great example of scripting. Combined with WMI, scripting is nothing short of amazing. The script on the next page shows you how to use VBScript and WMI to inventory a computer's configuration. It displays the amount of physical memory installed on the computer, the name of the computer, the BIOS version, the type of 214 Denso QR Bar Code Drawer In .NET Using Barcode encoder for ASP.NET Control to generate, create QR-Code image in ASP.NET applications. www.OnBarcode.comCode 39 Generator In .NET Framework Using Barcode encoder for ASP.NET Control to generate, create ANSI/AIM Code 39 image in ASP.NET applications. www.OnBarcode.comprocessor, and more. This script and many more like it are available on Microsoft's Script Center, which is a large library of scripts that you can download, modify, and use. All these scripts are at http://www.microsoft.com/technet/scriptcenter. 2D Barcode Encoder In .NET Using Barcode generator for ASP.NET Control to generate, create Matrix 2D Barcode image in ASP.NET applications. www.OnBarcode.comEncoding USD - 8 In .NET Framework Using Barcode encoder for ASP.NET Control to generate, create Code 11 image in ASP.NET applications. www.OnBarcode.comstrComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colSettings Wscript.Echo "OS Name: " & objOperatingSystem.Name Wscript.Echo "Version: " & objOperatingSystem.Version Wscript.Echo "Service Pack: " & _ objOperatingSystem.ServicePackMajorVersion _ & "." & objOperatingSystem.ServicePackMinorVersion Wscript.Echo "OS Manufacturer: " & objOperatingSystem.Manufacturer Wscript.Echo "Windows Directory: " & _ objOperatingSystem.WindowsDirectory Wscript.Echo "Locale: " & objOperatingSystem.Locale Wscript.Echo "Available Physical Memory: " & _ objOperatingSystem.FreePhysicalMemory Wscript.Echo "Total Virtual Memory: " & _ objOperatingSystem.TotalVirtualMemorySize Wscript.Echo "Available Virtual Memory: " & _ objOperatingSystem.FreeVirtualMemory Wscript.Echo "OS Name: " & objOperatingSystem.SizeStoredInPagingFiles Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colSettings Wscript.Echo "System Name: " & objComputer.Name Wscript.Echo "System Manufacturer: " & objComputer.Manufacturer Wscript.Echo "System Model: " & objComputer.Model Wscript.Echo "Time Zone: " & objComputer.CurrentTimeZone Wscript.Echo "Total Physical Memory: " & _ objComputer.TotalPhysicalMemory Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_Processor") For Each objProcessor in colSettings Wscript.Echo "System Type: " & objProcessor.Architecture Wscript.Echo "Processor: " & objProcessor.Description Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_BIOS") For Each objBIOS in colSettings Wscript.Echo "BIOS Version: " & objBIOS.Version Next Making Data Matrix 2d Barcode In None Using Barcode creation for Online Control to generate, create Data Matrix image in Online applications. www.OnBarcode.comReading Barcode In Visual Studio .NET Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comGenerating GTIN - 128 In Visual Basic .NET Using Barcode generator for VS .NET Control to generate, create GTIN - 128 image in .NET applications. www.OnBarcode.comPaint USS Code 39 In Java Using Barcode maker for Java Control to generate, create Code-39 image in Java applications. www.OnBarcode.comANSI/AIM Code 128 Maker In Java Using Barcode generator for Java Control to generate, create Code 128C image in Java applications. www.OnBarcode.comDraw Data Matrix ECC200 In Objective-C Using Barcode encoder for iPad Control to generate, create DataMatrix image in iPad applications. www.OnBarcode.comBar Code Maker In VB.NET Using Barcode creator for Visual Studio .NET Control to generate, create bar code image in .NET framework applications. www.OnBarcode.comPrint Bar Code In Objective-C Using Barcode maker for iPad Control to generate, create bar code image in iPad applications. www.OnBarcode.com |
|