Freigeben über


Script Encoder Syntax

 

Encodes scripting source code so it cannot be easily viewed or modified by users.

Note

The Script Encoder is not supported in Windows Vista or Windows 7.

Syntax

SCRENC [/s] [/f] [/xl] [/l defLanguage ] [/e defExtension] input file output file

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.

/l defLanguage

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.

/e defExtension

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.

Remarks

There are four kinds of files than can be processed by the Script Encoder. They are:

  • ASP. This format consists of a text active server page containing valid HTML and embedded scripting blocks within <SCRIPT> ... </SCRIPT> tags or <% ... %> tags. Applications that use this format include Microsoft Internet Information Services (IIS). Recognized file extensions are .asp, .asa, and .cdx.

  • HTML. This format consists of a text file that contains valid HTML along with embedded script blocks. Applications using this scripting format include Microsoft FrontPage, Microsoft Visual InterDev and virtually all Web designers and browsers. Recognized file extensions are .htm and .html.

  • Plain text. This format consists of text file that contains only script with no surrounding tags. Applications using scripting format include Windows Scripting Host (WSH) and Microsoft Outlook. Recognized file extensions are .js and .vbs, which are changed to .jse and .vbe, respectively, after encoding.

  • Scriptlet. This format consists of a text file that contains valid scriptlet code within <SCRIPT> ... </SCRIPT> tags. Recognized file extension is .sct and .wsh.

Examples

The following are examples of the use of the Script Encoder and a brief explanation of the results:

To encode input file test.html and produce output file encode.html, use:

screnc test.html encode.html

To encode input file test.htm and overwrite the input file with the encoded output file, use:

screnc /f test.htm

To encode all .ASP files in the current directory and place the encoded output files in c:\temp, use:

screnc *.asp c:\temp

To encode all files in the current directory as .ASP files and place them in c:\temp, use: screnc /e asp *.* c:\temp

To encode input file test.htm and produce output file encode.htm, ensuring that all script blocks that don't have a language attribute specified use VBScript, use:

screnc /l vbscript test.htm encode.htm

To encode all scriptlet files in the current directory and overwrite them with encoded files, while displaying no message, use:

screnc /s /f *.sct

See Also

Script Encoder Overview
Using Script Encoder
Script Encoding Sample