I have a .vbs script that I can run from the command line without a problem.
(simply using 'cscript script.vbs')

I don't know what syntax to use in order to properly create some sort of
batch file which I could then run by double-clicking or using the task
scheduler.

If I just copy and paste the syntax text from the command line window, it
will not work in a batch file, so I know I'm doing something wrong.

Thanks in advance.

Re: How can I turn a script into an executable ? by Dennis

Dennis
Mon Jan 23 18:40:10 CST 2006

From a command-line window:

"help start"
-or-
"start /?"

The command line _is_ your friend!



Re: How can I turn a script into an executable ? by Pegasus

Pegasus
Mon Jan 23 19:12:33 CST 2006


"JAQK" <johnny@tamtam.com> wrote in message
news:ASdBf.4663$Ez3.3200@trnddc03...
> I have a .vbs script that I can run from the command line without a
problem.
> (simply using 'cscript script.vbs')
>
> I don't know what syntax to use in order to properly create some sort of
> batch file which I could then run by double-clicking or using the task
> scheduler.
>
> If I just copy and paste the syntax text from the command line window, it
> will not work in a batch file, so I know I'm doing something wrong.
>
> Thanks in advance.
>

Use this syntax:

WScript.exe NameOfScript.vbs



Re: How can I turn a script into an executable ? by Steve

Steve
Tue Jan 24 03:48:51 CST 2006

"JAQK" <johnny@tamtam.com> wrote in message
news:ASdBf.4663$Ez3.3200@trnddc03...
>I have a .vbs script that I can run from the command line without a
>problem.
> (simply using 'cscript script.vbs')
>
> I don't know what syntax to use in order to properly create some sort
> of batch file which I could then run by double-clicking or using the
> task scheduler.
>
> If I just copy and paste the syntax text from the command line window,
> it will not work in a batch file, so I know I'm doing something wrong.
>
> Thanks in advance.
>

You cannot compile a script because it takes the run-time engine to
interpret the code.

You can encode the script by way of the Windows Script Encoder, look for
the encoder on the MS script site.

http://www.microsoft.com/mind/0899/scriptengine/scriptengine.asp

It's not 100% secure but will keep most users from modifying or viewing
the code.


--
Steve Parry BA (Hons) MCP MVP

http://mvp.support.microsoft.com/
http://www.gwynfryn.co.uk



Re: How can I turn a script into an executable ? by Steve

Steve
Tue Jan 24 03:53:10 CST 2006

"Steve Parry [MVP]" <k100rs_1990@nospam.hotmail.com> wrote in message
news:Owj8jtMIGHA.1188@TK2MSFTNGP14.phx.gbl...
> "JAQK" <johnny@tamtam.com> wrote in message
> news:ASdBf.4663$Ez3.3200@trnddc03...
>>I have a .vbs script that I can run from the command line without a
>>problem.
>> (simply using 'cscript script.vbs')
>>
>> I don't know what syntax to use in order to properly create some sort
>> of batch file which I could then run by double-clicking or using the
>> task scheduler.
>>
>> If I just copy and paste the syntax text from the command line
>> window, it will not work in a batch file, so I know I'm doing
>> something wrong.
>>
>> Thanks in advance.
>>
>
> You cannot compile a script because it takes the run-time engine to
> interpret the code.
>
> You can encode the script by way of the Windows Script Encoder, look
> for the encoder on the MS script site.
>
> http://www.microsoft.com/mind/0899/scriptengine/scriptengine.asp
>
> It's not 100% secure but will keep most users from modifying or
> viewing the code.
>
>


however .... :)

http://www.batchconverter.com/ExeScript-download-20966.shtml



--
Steve Parry BA (Hons) MCP MVP

http://mvp.support.microsoft.com/
http://www.gwynfryn.co.uk



Re: How can I turn a script into an executable ? by Joe_E

Joe_E
Tue Jan 24 06:51:41 CST 2006

A workaround is to use the iexpress.exe tool that ships with Windows
(2000 & beyond).
This tool allows you to create an EXE made up of a number of source
files into a single EXE.

Steps:
Let's assume you want to create myScript.exe that runs myScript.vbs
when a user double-clicks on the file (myScript.exe). Let's assume
further that you want myScript.vbs to be run using Cscript.exe as the
scripting host

* make sure that your script file name is in the short name format
(i.e. no longer that 8 characters and contains no spaces -->
myscript.vbs and not --> my script sample.vbs)
* create a batch file to run myScript.vbs and save this to the same
directory as myScript.vbs. See batch file for this is at bottom of this
thread
* From the start menu type IEXPRESS and select RUN
* When the IEXPRESS WIZARD pulls up select 'Create New self extracting
directive' and click NEXT
* On the PACKAGE PURPOSE screen select 'Extract files and run an
installation command' and click NEXT
* On the PACKAGE TITLE screen enter a descriptive name and click NEXT
* On the CONFIRMATION PROMPT select whether or not you want a prompt to
be shown to users before running and click NEXT
* On the LICENSE AGREEMENT screen you can specify a text file
containting a license that will be displayed to users. If you enable
this feature, users are prompted to accept alicense agreement by
clicking YES before the script will run
* On the PACKAGED FILES screen, click on ADD and then add the
myScript.bat and myScript.vbs files by navigating to the folder where
these files are stored. Once all files are added, click NEXT
* on the INSTALL PROGRAM TO LAUNCH screen select myScript.bat from the
INSTALL PROGRAM drop down list and click NEXT
* on the SHOW WINDOW screen leave 'Default' selected and click NEXT
* On the FINISHED MESSAGE screen you can enter a brief note to display
in a dialog box once the script completes. If not needed leave NO
MESSAGE selected and click NEXT
*On the PACKAGE NAME AND OPTIONS screen, click BROWSE and specify the
EXE file name that should be created, e.g. myScript.EXE. Under options
you can choose to hide the extraction window. I don't use the 'Store
File names ...' option but you could if needed. Click NEXT when done
* On the CONFIGURE RESTART screen you can define restart options for
the package . If no restart needed then select NO RESTART and click
NEXT
* You can save the package directive file on this last screen. Cick
NEXT to move on to the CREATE PACKAGE screen and click NEXT to create
the package (i.e. myScript.exe)

Package is then created and you can deploy the resulting EXE to your
users.

'<------- SAMPLE BATCH FILE TO RUN .VBS SCRIPT INSIDE IEXPRESS EXE -->

@ECHO OFF
CLS
cscript %0\..\myscript.vbs //NOLOGO

'<-- END SAMPLE BATCH FILE -->

Notes:
1. %0\..\ --> tell batch file to look for myScript.vbs in same
directory as the batch file
2. When a user runs the myScript.exe package the source files are
extracted to a folder under the users TEMP folder (i.e. C:\Documents
and Settings\%username%\Local Settings\Temp. The package install
command is run (i.e. myScript.bat) and when done this temp folder is
deleted.

Hope this helps.


Steve Parry [MVP] wrote:
> "JAQK" <johnny@tamtam.com> wrote in message
> news:ASdBf.4663$Ez3.3200@trnddc03...
> >I have a .vbs script that I can run from the command line without a
> >problem.
> > (simply using 'cscript script.vbs')
> >
> > I don't know what syntax to use in order to properly create some sort
> > of batch file which I could then run by double-clicking or using the
> > task scheduler.
> >
> > If I just copy and paste the syntax text from the command line window,
> > it will not work in a batch file, so I know I'm doing something wrong.
> >
> > Thanks in advance.
> >
>
> You cannot compile a script because it takes the run-time engine to
> interpret the code.
>
> You can encode the script by way of the Windows Script Encoder, look for
> the encoder on the MS script site.
>
> http://www.microsoft.com/mind/0899/scriptengine/scriptengine.asp
>
> It's not 100% secure but will keep most users from modifying or viewing
> the code.
>
>
> --
> Steve Parry BA (Hons) MCP MVP
>
> http://mvp.support.microsoft.com/
> http://www.gwynfryn.co.uk


Re: How can I turn a script into an executable ? by \

\
Tue Jan 24 07:02:19 CST 2006

> however .... :)

> http://www.batchconverter.com/ExeScript-download-20966.shtml

An interesting way to hide the script, but it still needs the interpreter to
run, I think, like VB "executables."
--
Crash



Re: How can I turn a script into a scheduled task ? by JAQK

JAQK
Tue Jan 24 15:21:33 CST 2006

I'm afraid I've totally misstated the question.

Yes, I can run it from the command-line, but I really need to run it as a
regularly scheduled task.

Now I could do that with a batch file, but I don't know how to encapsulate
the command line syntax into a batch file.

Just taking

'(start) cscript myscript.vbs >file.txt'

and dumping into the batch file, will run the script, but won't write to the
file, which is what I really need. This works only when I run it manually
from the command line.


"Dennis Glover" <dglover1@bellsouth.net> wrote in message
news:KHeBf.19$3m4.6@bignews5.bellsouth.net...
> From a command-line window:
>
> "help start"
> -or-
> "start /?"
>
> The command line _is_ your friend!
>
>



Re: How can I turn a script into an executable ? by JAQK

JAQK
Tue Jan 24 15:23:21 CST 2006

cscript works when I run the script manually from the command line.

what's the advantage of wscript.exe ?


"Pegasus (MVP)" <I.can@fly.com> wrote in message
news:%23ol6CNIIGHA.668@TK2MSFTNGP11.phx.gbl...
>
> "JAQK" <johnny@tamtam.com> wrote in message
> news:ASdBf.4663$Ez3.3200@trnddc03...
>> I have a .vbs script that I can run from the command line without a
> problem.
>> (simply using 'cscript script.vbs')
>>
>> I don't know what syntax to use in order to properly create some sort of
>> batch file which I could then run by double-clicking or using the task
>> scheduler.
>>
>> If I just copy and paste the syntax text from the command line window, it
>> will not work in a batch file, so I know I'm doing something wrong.
>>
>> Thanks in advance.
>>
>
> Use this syntax:
>
> WScript.exe NameOfScript.vbs
>
>



Re: How can I turn a script into a scheduled task ? by Richard

Richard
Tue Jan 24 15:41:43 CST 2006

Hi,

One solution is to modify the VBScript to use the FileSystemObject to write
the output to a text file. In brief:

=======================
' Specify text file.
strFile = "c:\Scripts\report.txt"

' Open text file for write access.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, 2, True, 0)

' Write a line to the file.
objFile.WriteLine "User Name: " & strName

' Close the file.
objFile.Close
======================

Where you may have used MsgBox or Wscript.Echo commands, you replace with
objFile.WriteLine. The script can write to anywhere accessible, but you need
to give the scheduled task sufficient permissions to write to the file.

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

"JAQK" <johnny@tamtam.com> wrote in message
news:xTwBf.30508$jd5.29289@trnddc02...
> I'm afraid I've totally misstated the question.
>
> Yes, I can run it from the command-line, but I really need to run it as a
> regularly scheduled task.
>
> Now I could do that with a batch file, but I don't know how to encapsulate
> the command line syntax into a batch file.
>
> Just taking
>
> '(start) cscript myscript.vbs >file.txt'
>
> and dumping into the batch file, will run the script, but won't write to
> the file, which is what I really need. This works only when I run it
> manually from the command line.
>
>
> "Dennis Glover" <dglover1@bellsouth.net> wrote in message
> news:KHeBf.19$3m4.6@bignews5.bellsouth.net...
>> From a command-line window:
>>
>> "help start"
>> -or-
>> "start /?"
>>
>> The command line _is_ your friend!
>>
>>
>
>



Re: How can I turn a script into a scheduled task ? by axtens

axtens
Tue Jan 24 19:45:27 CST 2006

>I can run it from the command-line, but I really need to run it as a regularly scheduled task

So perhaps you should look into leveraging the AT command

HELP AT gives:
.The AT command schedules commands and programs to run on a computer at
a specified time and date.

The Schedule service must be running to use the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] |
/NEXT:date[,...]] "command"
\\computername Specifies a remote computer.
Commands are scheduled on the local computer if this parameter is
omitted. id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further confirmation is
desired. time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week
or month. If date is omitted, the current day of the month is assumed.
/next:date[,...] Runs the specified command on the next occurrence of
the day (for example, next Thursday). If date is omitted, the current
day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.

Bruce