简体   繁体   English

Visual Studio 2017调试vbscript

[英]Visual Studio 2017 debugging vbscript

I'd like to debug a vbscript with Visual Studio 2017 Community Edition and followed the steps mentioned here for VS2015: 我想使用Visual Studio 2017 Community Edition调试vbscript,并按照此处提到的VS2015的步骤进行操作:

Video 视频

I entered 我进入了

cscript.exe /x foo.vbs

in the commandline, but no debugger starts. 在命令行中,但没有调试器启动。 Is there a problem with the 2017th version of VS or are there some steps (eg configuration steps in VS) which are not shown in the video? 2017的VS版本是否有问题,或者是否有一些步骤(例如VS中的配置步骤)未在视频中显示?

Edit: I tried cscript.exe //X foo.vbs , cscript.exe foo.vbs //X , cscript.exe //X //D foo.vbs and cscript.exe foo.vbs //X //D too 编辑:我试过cscript.exe //X foo.vbscscript.exe foo.vbs //Xcscript.exe //X //D foo.vbscscript.exe foo.vbs //X //D也是

Thanks steff 谢谢steff

Please run your VS2017 as the admin, and then enable the script option under TOOLS->Options->Debugging->Just-In-Time, and then re-debug it again. 请以管理员身份运行VS2017,然后在TOOLS-> Options-> Debugging-> Just-In-Time下启用脚本选项,然后重新调试。

在此输入图像描述

Even if I didn't use the VS2017 community version, but I get the same issue, I found that it was related to the JIT debugging in my side using VS2017 Enterprise version and it works well after I enable it: 即使我没有使用VS2017社区版本,但我遇到了同样的问题,我发现它与使用VS2017企业版的我身边的JIT调试有关,并且在我启用后它运行良好:

在此输入图像描述

Neither of those solutions worked for me. 这些解决方案都不适合我。 Found a workaround on MSDN MSDN上找到了解决方法

  1. Start Visual Studio. 启动Visual Studio。
  2. File -> Open Project. 文件 - >打开项目。
  3. Point it at "C:\\Windows\\system32\\cscript.exe" (or wherever your windows install directory is). 将其指向“C:\\ Windows \\ system32 \\ cscript.exe”(或Windows安装目录所在的位置)。
  4. When you get the elevation permissions dialog, click 'Ignore'. 获得高程权限对话框后,单击“忽略”。
  5. Go to project properties on the cscript.exe node. 转到cscript.exe节点上的项目属性。
  6. In arguments add '//d '. 在参数中添加'// d'。
  7. In 'Debugger type' change it to script. 在'调试器类型'中将其更改为脚本。
  8. Close project properties. 关闭项目属性。
  9. Hit F10 . 点击F10

CSCript.exe requires double-forward-slashes for its own command-line options, because single-slashed arguments are passed to the script itself. CSCript.exe需要双向正斜杠用于其自己的命令行选项,因为单斜线参数将传递给脚本本身。

You want cscript.exe //X not cscript /X . 你想要cscript.exe //X不是cscript /X

I also suggest the //D argument so it breaks immediately. 我还建议//D参数,以便它立即中断。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM