Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a script into a .exe

Status
Not open for further replies.

thysonj

Programmer
Jul 6, 2001
240
US
Ok I have a vb script that we run on the command line and we want to compile it into an exe that we can run from the command line. I have tried changing it into a vb program but I don't know how the get the script to run. Of course I have tons of syntax errors because they are different languages. Any ideas on how to get this running without rewriting the whole thing?
 
If your script isn't too huge, you could post it, or post a link to the code, and see if someone could get it to work in VB.

Just a thought, since it's hard to judge without seeing it.
 
Open a VB project, change the Start At to Sub MAIN. Add a MODULE from PROJECT. Put the first executed code in Procedure MAIN. Put the rest of the procedures following. Now Ctrl-F5 for a full compile before test.
 
You should be able to create a .VBS file and execute either from your desktop by creating a shortcut to it or from the START/RUN/OPEN.

example:
Code:
Call MyMsg

sub MyMsg()
	msgbox "This is a test", 0
End sub

Try. It works.
 
There is an easier solution, though perhaps you've tried it. Simply use either:
cscript.exe /E:VBScript filename.vbs
or
wscript.exe /E:VBScript filename.vbs

Its located in the winnt\system32 directory. This obviously doesn't compile it, but it does make it portable.

good luck.
 
nayone know how to wrap to following command into a .exe file......

rundll32.exe user32.dll,LockWorkStation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top