How To run vb.net with vbs scheduled task

2019-09-22 07:09发布

问题:

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?

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

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

Thanks, Andy

回答1:

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

How to run a VB.NET .vb file from vbs.

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

appactivate between multiple internet explorer instances

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

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.

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

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