你的位置: Kiyo'Space首页 服务器 阅读文章 欢迎留下您的足迹

How do you change Scripting Engine in Windows?

[ 服务器 ] 分享

("You are not using CScript for the scripting engine. Screen messages will be surpressed.")

Another day in paradise. I got this error when I was trying to run XCACLS.vbs which is a Microsoft utility to read/change permissions on files and folders.  This utility (XCACLS) has lot of more options than CACLS.exe.

I got the following error on my XP machine when running XCACLS.vbs file. There is even a spelling mistake in this error, see "Surpressed".

XCACLS Error

I searched the Internet for possible answers. I found some people wants to change the scripting engine the following command.

CScript //H:CScript //S

That seemed to be right answer. But the only problem is, it is not working for me.

I decided to find the answer by myself. I did a little post mortem of XCACLS.vbs file. The found the following lines which gave the above error popup in XCACLS.vbs file.

    If Not IsEngineCScript Then
                 Wscript.Echo "You are not using CScript for the scripting engine." & vbcrlf & "Screen messages will be surpressed."
    End if

Function IsEngineCScript()

    ON ERROR RESUME NEXT

    Dim strFullName, strCommand, i, j

    IsEngineCScript = False
    ‘strFullName should be something like C:\WINDOWS\COMMAND\CSCRIPT.EXE
    strFullName = WScript.FullName
    If Err.Number Then
    Wscript.Echo "Error while checking scripting engine." & vbcrlf & "Error " & Err.Number & ": " & Err.Description
    WScript.Quit
    End if

    i = InStr(1, strFullName, ".exe", 1)

 

After going through, There was bulb turned on in my head and it was very bright. The answer is,

XCACLS Fix

Hope you understood from the picture above. If not, follow the steps below.

1. Find a VBScript file on your hard disk. Right click on it and select Properties.

2. Click "Change" button

3. Select "Microsoft (R) Console Based Script Host"

4. Click OK.

The issue was VBS files are selected "Microsoft (R) Windows Basic Script Host" for default open action. This default open action supposed to be change automatically when you run "CScript //H:CScript //S" to Console based scripting host.  But it didn’t for some reason.

没有评论

  • (Required)
  • (Required, will not be published)