Tag: windows scripting

使用Windows脚本宿主

我正在使用Windows脚本主机用于某种安装程序应用程序,我正在使用它在开始菜单中创建快捷方式。 当我切换到x64环境时出现此问题(win7 ultimate x64 + vs2010) 我添加了对Windows脚本宿主对象模型的引用(来自c:\ windows \ syswow64 \ wshom.ocx),它生成了Interop.IWshRuntimeLibrary dll。 我添加了’using IWshRuntimeLibrary;’ 到我的.cs文件,但是当我尝试创建时 WshShell sh = new WshShellClass(); 它引发了一个exception: 无法加载文件或程序集“Interop.IWshRuntimeLibrary,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null”或其依赖项之一。 尝试加载格式不正确的程序。 我假设我需要64位版本的wshom.ocx来实现这一点,但我不知道应该尝试什么。 或者我只是转储Windows Script的东西,但我需要另一种方法来从.net应用程序创建开始菜单快捷方式。

将TypeScript编译器加载到ClearScript中,“WScript未定义”,不可能完成任务?

我尝试使用ClearScript加载TypeScript编译器以编译一些基本的TypeScript代码。 不幸的是,在执行TypeScript编译器源时,我收到此错误: ‘WScript’未定义 这是我使用的LINQPad程序,将ClearScript dll和TypeScript编译器文件放在.linq程序旁边: void Main() { using (var js = new Microsoft.ClearScript.Windows.JScriptEngine(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags.DisableSourceManagement)) { var typeScriptSource = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), “tsc.js”)); js.Execute(typeScriptSource); const string typeScriptCode = @” class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return “”Hello, “” + this.greeting; } } function test() { var greeter = Greeter(“”world””); return […]