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.

版权声明:
作者:Kiyo
链接:https://www.wkiyo.cn/html/2008-05/i569.html
来源:Kiyo's space
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>