Microsoft has provided a method to encode your script so that its source can't be viewed easily. This has been available since version 5 of the scripting engines.
Note: This is totally unsecure! Do not rely on this to hide passwords in your script.
Download the command line encoder from here... To encode a VBScript file just add the following comment near the top of your script...
'**Start Encode**
Everything after this point will be encoded.
To create the encoded file use the following command...
screnc myfile.vbs
This will produce a file with the same name but the extension will be .vbe which is recognised by WSH and an encoded file.
To encode script within a .wsf file
language=VBScript.Encode src="encodedfile.vbe">
Full SCRENC command line options:
SCRENC [/s] [/f] [/xl] [/l defLanguage ] [
/e defExtension]
inputfile outputfile The Script Encoder syntax has these parts:
| Part | Description |
| /s | Optional. Switch that specifies that the Script Encoder is to work silently, that is, produce no screen output. If omitted, the default is to provide verbose output. |
| /f | Optional. Specifies that the input file is to be overwritten by the output file. Note that this option destroys your original input source file. If omitted, the output file is not overwritten. |
| /xl | Optional. Specifies that the @language directive is not added at the top of .ASP files. If omitted, @language directive is added for all .ASP files. |
| <NOBR>/l defLanguage</NOBR> | Optional. Specifies the default scripting language (JScript® or VBScript) to use during encoding. Script blocks within the file being encoded that do not contain a language attribute are assumed to be of this specified language. If omitted, JScript is the default language for HTML pages and scriptlets, while VBScript is the default for active server pages. For plain text files, the file extension (either .js or .vbs) determines the default scripting language. |
| <NOBR>/e defExtension</NOBR> | Optional. Associates the input file with a specific file type. Use this switch when the input file's extension doesn't make the file type obvious, that is, when the input file extension is not one of the recognized extensions, but the file content does fall into one of the recognized types. There is no default for this option. If a file with an unrecognized extension is encountered and this option is not specified, the Script Encoder fails for that unrecognized file. Recognized file extensions are asa, asp, cdx, htm, html, js, sct, and vbs. |
| inputfile | Required. The name of the input file to be encoded, including any necessary path information relative to the current directory. |
| outputfile | Required. The name of the output file to be produced, including any necessary path information relative to the current directory. |
Tips for encoding other file types coming... </SCRIPT>