none
CScript Error: Can't change default script host.

    Question

  • C:\Users\Eric>cscript //H:CScript //nologo //S
    Command line options are saved.
    CScript Error: Can't change default script host.

    -------

    Does anyone know why this can't be changed?

     

     

    Sunday, June 11, 2006 6:26 PM

All replies

  • I need this to work as well.  Is this a problem due to the User Account Control or something else?  How do you override it?
    Wednesday, July 12, 2006 7:58 PM
  • I believe you can do this if you run cmd.exe as an admin.

    For me, I went to c:\windows\system32 in windows explorer

    Then I right clicked the cmd.exe and chose to run as an admin.

    Wednesday, September 06, 2006 8:16 PM
  • Running cmd.exe as admin still does not allow me to change the default script host.

    Can somebody shed some light on this?

    Friday, June 15, 2007 9:38 PM
  • Can ANYBODY help?
    Friday, July 06, 2007 5:20 AM
  • Anyone at all?

    I get the same error as FlyingHorse, even when running the command prompt as Administrator.
    Friday, September 12, 2008 1:39 AM
  • I have the same error on a Win XP PC all updates installed.

    It doesn't matter whether I use cscript.exe or wscript.exe, both commands fail.

    I am an administrator on the PC, but I also tried using a different administrator account and even creating a new administrator account and every time it fails.

     

    C:\>cscript //H:CScript
    CScript Error: Can't change default script host.

     

    C:\>wscript //H:CScript

    Saturday, September 13, 2008 7:33 AM
  • I had the same problem.
    Looking at the regmon log on a system where I could successfully change the default script host, I noticed the default shell commands were being set to "Open2" (Cscript) for each file type handled by windows script host.

    Here's a reg edit file I came up with to update them all:
    Windows Registry Editor Version 5.00 
     
    [HKEY_CLASSES_ROOT\JSFile\Shell] 
    @="Open2" 
     
    [HKEY_CLASSES_ROOT\VBSFile\Shell] 
    @="Open2" 
     
    [HKEY_CLASSES_ROOT\WSHFile\Shell] 
    @="Open2" 
     
    [HKEY_CLASSES_ROOT\WSFFile\Shell] 
    @="Open2" 



    Still don't know what causes the problem, but this worked for me.



    • Proposed as answer by msl0 Tuesday, September 29, 2009 2:09 PM
    Saturday, February 07, 2009 7:49 AM
  • I just changed default program to run .js fuiles in windows explorer. Right click on any .js file, then "Open with -> Choose program ...". Choose "Microsoft (R) Windows Based Script Host" or "Microsoft (R) Console Based Script Host", and set checkbox "Always use the selected program to open this kind of file.

    The post from dst80 let me find this solution. This way I could change the default script host to cscript.
    • Proposed as answer by msl0 Tuesday, September 29, 2009 2:08 PM
    Tuesday, September 29, 2009 2:08 PM
  • The reason it cant be changes is that UAC is interferring with the default command prompt (running in standard user mode).

    Open command prompt w/ administrative permissions (right click, run as administrator), then run the command (cscript //h:cscript //nolog //s). 

    There should be a way to elevate permissions via command line (like sudo in *nix), but I haven't found it yet.

    In any case, this should get you going.

    PS...  I know it's an old post, but it was the first one to pop up in Google for my search.  Since it had no solution yet I figured I'd help out anyone who comes searching for this later.
    Tuesday, April 05, 2011 7:34 PM
  • Thanks a lot for your  Answer. I was able to set my Windows 7 Operating System WSH to the default CScript.................
    Monday, November 14, 2011 2:01 PM
  • The reason it cant be changes is that UAC is interfering with the default command prompt (running in standard user mode).

    Open command prompt w/ administrative permissions (right click, run as administrator), then run the command (cscript //h:cscript //nolog //s). 


    This solution worked for me except... the //nolog switch should be //nologo

    Thank you RB1969.

    DustAndAshes
    "Better a fool in the eyes of God than a fool in the eyes of man."

    Thursday, September 13, 2012 1:34 PM