Re: Re: vbs to exe



I was having similar issues, when i wanted to configure a windows service to run my vbs code. i wanted to convert vbs to exe in order to do this.
finally used the cscript.exe utility to directly complile and run my vbs from the windows service.

If your issue is somewhat similar, hope this will work!

My sample code:

Set objService = objWMIService.Get("Win32_BaseService")
errReturn = objService.Create("CreateFile" ,"Create a file" , _
"cscript.exe 'D:\Pratish\printdoc.vbs'", OWN_PROCESS, NORMAL_ERROR_CONTROL, "Automatic", _
NOT_INTERACTIVE, NULL, "" )

On Monday, April 09, 2007 5:28 PM Jake Wisema wrote:

I need a (1) cheap (preferably free) and (2) easy way to convert VBScript
files to stand-alone executables. I know that Visual Studio 6.x can do it
very easily, but being that it will no longer be supported as of March 2008,
I am looking for another solution. The ideal solution would be a simple
method for Visual Studio Express edition to convert from VBS to executable
files. I have tried to do this and have not found a way that is anything
close to the ease of Visual Basic 6.

I realize this question was posted in April 2005, but the answers are not
quite what I am looking for.


On Monday, April 09, 2007 6:17 PM Richard Mueller [MVP] wrote:

Jake Wiseman wrote:


Best might be to use Visual Studio 6 to convert the VBScript to VB6, then
open in Visual Studio .NET and let the wizard convert. What the wizard
cannot handle is going to require a lot of work no matter how you do it.
Also, any VB6 executable you create should be fine.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


On Monday, April 09, 2007 7:15 PM mayayana wrote:

Can't be done. A script is interpreted code.
An EXE is compiled. Nothing compiles
script ... because it's not programming code.


No, it can't.


What does that matter?


A stand-alone executable means one that doesn't need
support files. If you want to make an actual EXE that has
nothing to do with script. You can't convert a script to EXE.
If you write an EXE in VS6 (VB or C++) it's almost stand-alone,
insofar as almost all systems will have the support files.
VS Express is dotnet v.2. That requires that the 70+ MB
dotnet V.2 runtime be installed. You can write a pseudo-EXE
in C# or VB.Net, but that's not stand-alone in most scenarios.

Another option is to just put it into a zip file and make
that a self-executing zip (exe). Set the command line
to the name of the VBScript. The only problem with
that is that it requires the WSH (so not stand-alone) and
it may get blocked from running by anti-virus programs.


On Monday, April 09, 2007 7:57 PM MikeB wrote:

quickly googled

http://www.nsbasic.com/desktop/


On Tuesday, April 10, 2007 6:42 AM Andreas Woll wrote:

I have got one for you.

Have a look here:
http://www.f2ko.de/English/v2e/v2e.html

Andreas


On Wednesday, April 11, 2007 5:35 PM mr_unreliable wrote:

mikHar usually steps in here and recommends the "Admin
Script Editor" (the Script Packager feature will wrap your
script into an Exe). Since he is apparently out-to-lunch
right now, I will make the suggestion for him. You can
find the A.S.E. here:

http://www.adminscripteditor.com/editor/features.asp

Sorry, it's not free ($100 bucks).

Then there is my own (boast, boast) classic discussion
on "Cheap and Dirty" methods, found here:

http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/599e1512a9a1ff52/65533e537dbd4ed0?lnk=st&q=&rnum=5#65533e537dbd4ed0

Probably the most "professional" and free approach would be
to switch to autoit (the scripting language):

http://www.autoitscript.com/autoit3/

The autoit and vbs scripting languages are very similar,
and you could convert quite easily. If you are too lazy
for that, you can find "converter" code on their forum:

http://www.autoitscript.com/forum/index.php?showtopic=12143

After you are running in autoit, you can then convert your
script to exe directly, using the Aut2Exe utility which comes
with the autoit package.

<quote>
It is possible to take your .au3 script and compile it into
a standalone executable; this executable can be used without
the need for AutoIt to be installed and without the need to
have AutoIt3.exe on the machine. In addition, the compiled
script is compressed and encrypted and there is the option
to bind additional files (also compressed/encrypted) to the
exe using the FileInstall function. Also, any #include files
will also be compiled into the script so they are not
required at run-time.
</quote>

Jonathan Bennett and his autoit gang deserve a lot of credit
for coming up with a language like that with all the bells-
and-whistles. In many respects autoit puts vbs to shame.
Be sure to send them some paypal cash to keep the effort
going.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

Jake Wiseman wrote:


On Friday, April 13, 2007 1:31 PM mr_unreliable wrote:

I just remembered that there had been previous responses
to this question to the effect that you could convert
your script to an exe by wrapping it in an "installer".

As you know, an installer "installs software" -- a process
which can be as simple or as complicated as you like. The
installer is typically an exe file, with "other stuff"
bundled into it. The "other stuff" can be programs, data
files, actX objects, registry changes, utilities to run...
in other words all the "stuff" you need to install your
software.

Most installers worthy of the name can do at least the
following:

- Wrap up program files and data files into an exe,
for extraction and installation later.

- Run utilities

And so, consider the "installer option" for converting
a vbs script into an exe.

Simple Case (Your target system has scripting installed):
Wrap up the script into the exe, and include instructions
to copy it out to the client system and run it.

More Complicated Case: (Your target system does NOT have
scripting installed). Wrap up the script, plus wscript
and its associated dll's. The installer then copies out
all this stuff to the target system, and runs the script.
If this is a "stealth run", then you may wish to erase
the script and wscript files when you are finished.

For you guys/gals who know the Microsoft Installer product,
then you are all set for this option. Or, if you want to
try it, then it's available in the Vista SDK (a 5hr download
at slo-DSL speed). If you are using something older than
Vista, you may be out-of-luck, I didn't see any SDK download
available for older systems. As I recall, you may have
the installer if you have Visual Studio. Caution: you may
thing that you have the microsoft installer on your system
already, because when you click on an "msi" package, it gets
installed. But Wait! -- I'm talking about the program which
packages up the stuff to install in the first place.

For the rest of you, I suggest the "Nullsoft Scriptable
Install System". It is free, and is available (with source)
from "Source Forge", provided you will agree to the usual
open-source licensing terms and conditions. There is a
"stable" system offered, and a (presumably more risky)
"beta" version.

http://nsis.sourceforge.net/Main_Page

http://nsis.sourceforge.net/Developer_Center

The appeal of NSIS is the scriptability of it. It's not vbs
(or vba for that matter), but apparently you can script it
to do almost anything. In fact, for many if not most scripting
functions, you could do most of them directly with NSIS,
without bothering to run a vbs script at all. But getting back
to the main issue, you could bundle up your script in an exe
installer package, copy your script to the target system, and
then run it. You could also script in a test to see if the
system had scripting installed, and if not then install wscript
and the associated dll's too.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


On Tuesday, April 17, 2007 12:00 AM E C H (He of too much code) wrote:

mr_unreliable wrote:
<SNIP>
As an interesting side note. Their is not currently a way to decompile these installers.
Not sure of the specifics, but apparently, it has to do with the lack of structured code.


On Monday, October 13, 2008 10:09 AM ny turn wrote:

I am happy with ExeScript from ScriptCode:
http://www.scriptcode.com/


On Tuesday, October 14, 2008 6:15 PM Sa6ry wrote:

Check this online script converter, it converts vbs to exe online
http://www.vbs2exe.com/


On Thursday, October 30, 2008 12:39 PM Oleg Tsheglov wrote:

It could be done quic and easy with ScriptCryptor compiler from http://www.abyssmedia.com/scriptcryptor/


On Friday, October 31, 2008 12:17 AM Paul Randall wrote:

<Oleg Tsheglov> wrote in message
news:2008103012392support@xxxxxxxxxxxxxxxxxxxx

Is this freeware, shareware, nagware, crippledware or what? I could not
find a price list. May be I expect to not be required to scroll down a
huge blank page to get to some possible info.


-Paul Randall


On Friday, October 31, 2008 1:12 PM mr_unreliable wrote:

Paul Randall wrote:

Paul, I don't see any "huge blank page". The url provided
renders ok with firefox 2.00.17.

As to the purchase option, it appears to be a "for sale"
product, at $54.95 per copy. See here:

http://www.abyssmedia.com/order.shtml

cheers, jw


On Friday, October 31, 2008 7:22 PM mayayana wrote:

I heartily agree with Paul. The price and terms should
be on the same page where the download link is. Anything
else is just sleazy marketing. And for anyone who might
actually fall for this scam, I'll explain to them how to make
a self-executing zip file for only $49.99*. :)

* Plus shipping and handling, of course. I'll let them
know how much that costs when they place an order.


On Friday, October 31, 2008 8:52 PM X22degg5 wrote:

ScriptCryptor Compiler
Convert VBS to EXE and JScript to EXE files. US$54.95


On Friday, October 31, 2008 9:07 PM Paul Randall wrote:

"mr_unreliable" <kindlyReplyToNewsgroup@xxxxxxxxxxx> wrote in message
news:%23nmCmp3OJHA.3748@xxxxxxxxxxxxxxxxxxxxxxx

Hi, jw
Thanks for the feedback.

I'm running IE6 on a laptop with a 1024 by 768 screen, with text size set to
largest. This web page uses less than 800 pixels of the available width to
display its information and seems to have reasonable rules on how to handle
all text size settings except largest, in its restricted width.

-Paul Randall


On Friday, October 31, 2008 11:42 PM icezon wrote:

Here is a working solution: http://www.abyssmedia.com/scriptcryptor
Unlike the other converters it really convert script into native EXE
and doesn't extract script to the TEMP folder. In additional it
support WScript object.


On Saturday, November 01, 2008 3:04 PM Sa6ry wrote:

check vbs2exe from http://www.vbs2exe.com/
or http://www.xneat.com/application-builder/index.htm

does the same for only 17.5$

<Oleg Tsheglov> wrote in message


On Tuesday, November 04, 2008 11:13 AM mr_unreliable wrote:

mayayana wrote:

I presume that mayayana's "secret" is to recommend the "last
free" version of the Power Archiver product (v6.1.1). Power
Archiver will zip up your script, wrap it in an exe, and when
you run it will unzip the script and execute it for you. This
is not exactly "magical", you have do a lot of reading and
understanding of switches and options. However it is a
feasible way to get from script to exe.

You can find more discussion on this by searching this ng for
power archiver and mayayana.

I only have one "major beef" with P.A. When you install it,
it will (gratuitously) insert itself into every context menu
on your system, and it will take you (or it took me) at least
a day to get the registry cleaned out (i.e., to get all the
context menu's back to what they were before P.A.).

fwiw, I would advise using another language if you want script-
to-exe. There are several vb-like scripting languages out there
which provide for wrapping into an exe as part of the language.
Converting to any of these languages from vbs is a "piece-of-cake".
Then there is vb itself, which is even easier to convert into from
vbs. However, the "classic" (vb5/6) is a much easier conversion
than vb.net.

cheers, jw

p.s. One last "pet peeve". vbScript is a misnomer. "Visual" basic
is a product which took dos basic into a new realm, i.e., it added
a "GUI" (vb Forms and dialogs). The only "visual" thing about vbs
is the msgbox and askbox. You could call vbs a distant cousin of
vb, because vbs is a subset of the vb language. But since vbs is
lacking in the "visual" aspect of vb, then it is probably more
appropriate to call it un-vbScript...


On Tuesday, November 04, 2008 11:59 PM Al Dunbar wrote:

"mr_unreliable" <kindlyReplyToNewsgroup@xxxxxxxxxxx> wrote in message
news:%23GeHTbpPJHA.4776@xxxxxxxxxxxxxxxxxxxxxxx

<snip>


Personally, I have never thought of it that way. VB is, most definitely,
short for Visual Basic, and the two names are used interchangeably.

I have never, ever, heard anyone refer to VBScript as "Visual Basic Script".
To me, the name VBScript fits perfectly, as it is the scripting equivalent
of VB. The main equivalency is the syntax of the language, not the (missing)
visual aspect. As you point out the syntax is not identical - just close
enough that someone comfortable in VB would likely have little difficulty
becoming a VBScripter.

Of course, there is nothing particularly "visual" about the VB language
itself - that aspect only comes from the environment in which VB code runs.
VBScript code itself is similarly free of a visual interface; the main
difference being that*one* of its environments (WSH) lacks all but the very
basic visual interface tools. But VBScript code can run in other
environments, including HTML, ASP, and HTA, all of which are undeniably
"visual" in nature.

But you'll enjoy this last point: my last two MVP awards were in a category
called "Visual Developer - Scripting"! I commented on this in my profile by
saying I was not so much the developer of visual scripts, but of scripts
that generally run invisibly. In fact, that is what appeals to me: scripts
as tools that do the work but without the attention-seeking profile of more
immature "visual" environments. ;-)

If you are able to get people to call it uVBScript, I will go along with you
on that ride ;-)

/Al


On Wednesday, November 05, 2008 8:47 AM mayayana wrote:

I've tried twice to respond to this post and it was blocked
both times. Here's #3:

My post was intended to be a joke. There's no such
thing as compiling VBS to native code (EXE). But an
SFX (self-executing zip) will do what most people want
by packaging the script into a self-unpacking EXE file
that will unpack to the folder of one's choice and shell
any selected file inside.

I don't have any special preference for PA 6.1. It's just
that I'm used to it myself, it's free, it works, and it has
an unrestricted license. I recommend it for that reason,
but there are lots of free ZIP programs around. The point
is that one can get a decent ZIP program, most of which
will produce SFX files, for free. There's no need to pay
for overpriced bloatware. (The code behind ZIP programs,
after all, is from Info-ZIP, made freely available to the public.)


On Thursday, November 06, 2008 12:27 PM mr_unreliable wrote:

mayayana wrote:

I've tried posting stuff here and been blocked too.

So ms must have some built-in filters. They are not
telling us -- probably because then it would be easier
to circumvent them.

I did happen to figure out one filter (blocking criteria).
In a posting made last summer suggesting how to use shockwave
from script to display a video clip, I suggested using the
"joke-video-of-the-week", i.e., the Payer-reese Heel-tone
fer Pray-zee-dint video (in my posting I used correct spelling)
-- as a sample video for testing the script. Apparently, the
"fer Pray-zee-dint" (spelled correctly) was being blocked,
presumably to eliminate any possibility of using this ng
for political purposes.

I have had other stuff blocked too, but couldn't figure
out why. Some stuff which ms might reasonably be expected
to consider seditious, (like suggesting other scripting
languages) has not been blocked.

cheers, jw


On Thursday, November 06, 2008 6:07 PM mayayana wrote:

That's an interesting find. I've been thinking of saving
the blocked posts to look for a pattern, but I haven't
got around to it. Someone posted something a couple
of weeks ago in the VB group that was encoded as a
VBScript using Chr(xx) & Chr(yy) & .... etc. Apparently
he'd tried to post many times and it didn't work, but it
cam through once it was encoded. :)


On Friday, December 12, 2008 3:59 AM lost.2 wrote:

On Oct 14, 5:15=A0pm, "Sa6ry" <no-m...@xxxxxxxxxxxxx> wrote:
ww.vbs2exe.com/

Thanks for the VIRUS!!! This link says their site is to busy and
please download their tool. I did and before I got the delete script
to stop it deleted 100GB of data. Luckily I can retrieve it but most
people wouldn't know how to.


On Friday, December 12, 2008 3:59 AM BigDaddyJim wrote:

On Dec 9, 3:42=A0pm, lost...@xxxxxxxxx wrote:
/www.vbs2exe.com/

I like this solution, but is not free, in fact it is relatively
expensive. But, it works great. Silent execution is a feature.

EXESCRIPT 3.0

http://www.hide-folder.com/overview/hf_7.html

Jim


Submitted via EggHeadCafe
SQL Operations on a Text File with ADO.NET
http://www.eggheadcafe.com/tutorials/aspnet/37ed9e1b-c5de-4c0b-afbe-d8f78f9a6ecf/sql-operations-on-a-text-file-with-adonet.aspx
.