How to know valid script engine names for CScript.exe's //E:engine option?
Asked Answered
P

2

6

When you execute a file with .VBS, .JS or .WSF extensions via CScript.exe, they execute correctly:

CScript vbsProg.vbs
CScript jsProg.js
CScript wshScript.wsf

However, we may use //E:engine option to run VBS or JScript files with different extensions:

CScript //E:VBS vbsProg.txt
CScript //E:JScript jsProg.txt

Is there any way to do the same thing with a WSF file?

CScript //E:WhatGoesHere wshScript.txt

Is there any place where script engine names are documented? Is there any way to know the names of all installed engines?

Thanks!

Antonio

Pearly answered 31/1, 2013 at 15:20 Comment(2)
I have a similar issue. I'm trying to call a WSF from another WSF, but it keeps failing. Have you had any luck?Tammara
@meffordm: See the new answer below...Pearly
P
3

Although there is no way to know the names of the installed engines for CScript //E: command, there is a very simple way to execute a file with any extension as a .wsf one:

CScript wshScript.txt?.wsf

Further details at this post.

Pearly answered 27/4, 2014 at 20:29 Comment(0)
B
4

[EDIT] After reading Ekkehard Horner comment I decide to strike out my first sentence about //E switch.

The WSF itself is a batch-job file that may hold scripts in different languages like:

<package>
  <job>
    <script language="VBScript">
      WScript.Echo "Echo from VBScript"
    </script>
    <script language="JScript">
      WScript.Echo("Echo from JScript");
    </script>
    <script language="XYZ">
      //where XYZ s`d be a valid name of installed language
    </script>
  </job>
</package>

And //E is not applicable to WSF files at all. CScript recognize them only by their extension, that mean the only way to run WSF via CScript is:

CScript ScriptName.WSF
Benzvi answered 31/1, 2013 at 16:23 Comment(6)
"you can't use engine switch //E for something else than VBS or JScript" is wrong. Given an installed ActiveState Perl //E:PerlScript works ok (that I can prove). All installed ActiveScript language names are (probably) valid parameters for //E. However, your conclusion wrt to .WSF may well be right.Dawson
"All installed ActiveScript language names are (probably) valid parameters for //E" - this is new to me, what to say, probably you're rigth.Benzvi
+1 for improvement, although I'm very unhappy about the conclusion "no WSF value for the //E: switch".Dawson
Is there any way to know the names of "all installed ActiveScript languages"?Pearly
@Dawson - Thanks, as for WSF... is not Script Engine, right? At least has not such keys into Win Registry.Benzvi
@Pearly - This is not easy question for me. Searching into Win Registry... but it's a bit of hell. I hope someone to know better way.Benzvi
P
3

Although there is no way to know the names of the installed engines for CScript //E: command, there is a very simple way to execute a file with any extension as a .wsf one:

CScript wshScript.txt?.wsf

Further details at this post.

Pearly answered 27/4, 2014 at 20:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.