如何使用 vbs 计划任务运行 vb.net [英] How To run vb.net with vbs scheduled task

查看:70
本文介绍了如何使用 vbs 计划任务运行 vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 Windows 计划任务以打开 .vb 脚本,但是当我运行该任务时,它只打开 .vb 脚本而没有执行任何其他操作.是否有 .vbs 脚本可以打开我的 .vb 脚本视觉工作室并运行我的子程序?

I'm trying to run a windows scheduled task to open a .vb script, but when i run the task, it just opens the .vb script and does nothing else. Is there a .vbs script that will open my .vb script visual studio and run my sub?

我有一个 .vbs 脚本,可以打开 excel 并运行宏,只是不知道如何使用 Visual Studio

I have a .vbs script that will open excel and run macros, just not sure how to do it with visual studio

当我在 Visual Studio 中手动执行时,子程序运行良好

The sub runs fine when i do it manually in visual studio

谢谢,安迪

推荐答案

它确实与 VB.NET 有关.虽然我花了一天时间才看到真正的问题.

It does have something to do with VB.NET. Although it took me a day to see the real question.

如何从 vbs 运行 VB.NET .vb 文件.

你必须编译它.这是一篇关于如何做到这一点的文章.

You have to compile it. Here's an article about how to do that.

在多个 Internet Explorer 实例之间激活应用

尽管由于名称冲突,给出的示例在 7 及更高版本中不起作用.将 sendmail 重命名为 7 及更高版本的其他名称.

Although the sample given doesn't work 7 and later because of a name conflict. Rename sendmail to something else for 7 and later.

如果是受限用户,您需要手动将注册表项添加到 hkcu\software\classes.为此,导出为 reg 文件 (regasm/reg) 并搜索 HKEY_CLASSES_ROOT 并将其替换为 HKEY_CURRENT_USER\Software\Classes 并将其与 regeditreg 合并.

If a limited user you need to manually add the registry entries to hkcu\software\classes. Do this by exporting as a reg file (regasm /reg) and search and replace HKEY_CLASSES_ROOT with HKEY_CURRENT_USER\Software\Classes and merge it with regedit or reg.

此外,如果您在语句和子项周围加上额外的括号,则 vbscript 代码主要在 VB.NET 中工作.

Also if you put in extra brackets around statements and subs vbscript code works in VB.NET mostly.

有关如何在 vb.net 中运行 vbscript 代码的信息,请参阅此处.

See this for how to run vbscript code in vb.net.

http://social.msdn.microsoft.com/Forums/en-US/adcae113-4758-481a-a367-60d5d14d97d6/this-is-how-to-turn-vbs-and-js-files-into-exe-files-from-the-command-line-without-third-party-tools?forum=scripting

这篇关于如何使用 vbs 计划任务运行 vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆