Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Scripting
Script Runtime
 Using Script Encoder

  Switch on low bandwidth view
This page is specific to
.NET Framework 3.0

Other versions are also available for the following:
Scripting Runtime Library
Using Script Encoder

The Script Encoder encodes only scripting code, with all other file content left untouched to appear as plain text. To use the Script Encoder, develop and debug your script in the usual manner, then use this utility to encode your final script. The Script Encoder uses markers within your source code to identify where encoding should begin.

For Visual Basic® Scripting Edition (VBScript), the following example illustrates how the encoding marker is used to expose a plain-text copyright message:

<SCRIPT LANGUAGE="VBScript">
'Copyright© 1998. XYZ Productions. All rights reserved.
'**Start Encode**
' Your code goes here.
</SCRIPT>

In JScript®, the encoding marker looks like this:

<SCRIPT LANGUAGE="JScript">
//Copyright© 1998. ZYX Productions. All rights reserved.
//**Start Encode**
// Your code goes here.
</SCRIPT>

When the Script Encoder is invoked, anything in the script block before the start marker is left unencoded, while everything else in the script block is encoded. Therefore, if the start marker is omitted, the entire scripting block is encoded, but if the start marker is at the end of the scripting block, nothing is encoded.

After the encoding takes place, you should be aware that the language designator in the <SCRIPT> tag has changed. For VBScript, the new designator looks like this:

<SCRIPT LANGUAGE="VBScript.Encode">

For JScript, the new designator looks like this:

<SCRIPT LANGUAGE="JScript.Encode">

The Script Encoder is invoked on the MS-DOS command line or in the Run dialog box as follows:

SRCENC [switches] inputfile outputfile

Community Content   What is Community Content?
Add new content RSS  Annotations
Windows XP SP3 Kills Script Encoder      spasecookee ... ibsteve2u   |   Edit   |   Show History
It should be noted that after installing windows XP SP3, the script encoder, screnc.exe, will not work. You will continue to get an error like "screnc.exe has encountered a problem and needs to close. We are sorry for the inconvenience."

AppName: screnc.exe AppVer: 0.0.0.0 ModName: msvcrt.dll
ModVer: 7.0.2600.5512 Offset: 00036fa3

This error will only occur when actually trying to encode a script, simply running screnc.exe will not cause the error. I don't see MS fixing this error any time soon, so if you need the script encoder, you will have to skip SP3, or have a VM handy that skips SP3.

Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker