【问题标题】:VBScript: Open .dita file typeVBScript:打开 .dita 文件类型
【发布时间】:2015-03-19 00:16:25
【问题描述】:

我正在尝试通过 VBScript 打开一个 .dita 文件(我希望它会启动我的编辑器)。我在这行代码中不断收到运行时错误:

CreateObject("WScript.Shell").Run "testfile.dita"

每条有用的错误信息都只是“错误”。我假设它是文件类型,因为它适用于 .exe 和 .txt 文件。谁能建议我如何解决这个问题或提供替代方案?

【问题讨论】:

  • 这个.dita文件的编辑器是什么??
  • @Hackoo XMetal Author Enterprise 9.0

标签: vbscript dita


【解决方案1】:

这应该可以工作

CreateObject("WScript.Shell").Run "cmd /c start testfile.dita"

【讨论】:

  • 这行得通,谢谢!我如何将文件路径传递给它呢?我希望它从存储在变量中的文件路径运行文件。
  • 请将我的答案标记为您问题的答案。传递变量使用CreateObject("WScript.Shell").Run "cmd /c start " & YourVariable
  • 完成,谢谢。这是我现在拥有的代码。文件路径是正确的,额外的引号允许路径中有空格,但什么都没有打开。有任何想法吗? CreateObject("WScript.Shell").Run "cmd /c start """&objPath&""
  • 这会有点脏.. CreateObject("WScript.Shell").Run "cmd /c start """" """ & objpath & """" 或者有更干净的代码使用CreateObject("WScript.Shell").Run "cmd /c explorer " & objpath
  • 清洁工完美运行,感谢您抽出宝贵时间@Pupa Rebbe :)
猜你喜欢
  • 2020-01-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多