Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Write instructions at the command prompt

Reply
 
Old 07-16-2009   #1 (permalink)
xp


 
 

Write instructions at the command prompt

Using Windows XP and Office 2007;

I need to code a command line instruction using a VBScript file; I've coded
VBScript for other purposes, but I don't know where to start for something
like this. Is there a chance someone could post a generic way to access the
command prompt and then write some instructions?

Thanks!

My System SpecsSystem Spec
Old 07-16-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Write instructions at the command prompt


"xp" <xp@xxxxxx> wrote in message
news:59D78EEA-807B-4517-923E-9391275B7CB0@xxxxxx
Quote:

> Using Windows XP and Office 2007;
>
> I need to code a command line instruction using a VBScript file; I've
> coded
> VBScript for other purposes, but I don't know where to start for something
> like this. Is there a chance someone could post a generic way to access
> the
> command prompt and then write some instructions?
>
> Thanks!
I can think of three ways:
- Use the Run method to open a Command Prompt, then use the SendKeys method
of the Wscript.Shell object to send your keystrokes. This is easy to program
but it is also clumsy and unreliable.
- Use the Run method to invoke a batch file of your choice.
- Use the Exec method to invoke a batch file of your choice.

I suggest you download the help file script56.chm from the Microsoft site to
see detailed examples of the various methods.


My System SpecsSystem Spec
Old 07-16-2009   #3 (permalink)
Tom Lavedas


 
 

Re: Write instructions at the command prompt

On Jul 16, 9:13*am, "Pegasus [MVP]" <n...@xxxxxx> wrote:
Quote:

> "xp" <x...@xxxxxx> wrote in message
>
> news:59D78EEA-807B-4517-923E-9391275B7CB0@xxxxxx
>
Quote:

> > Using Windows XP and Office 2007;
>
Quote:

> > I need to code a command line instruction using a VBScript file; I've
> > coded
> > VBScript for other purposes, but I don't know where to start for something
> > like this. Is there a chance someone could post a generic way to access
> > the
> > command prompt and then write some instructions?
>
Quote:

> > Thanks!
>
> I can think of three ways:
> - Use the Run method to open a Command Prompt, then use the SendKeys method
> of the Wscript.Shell object to send your keystrokes. This is easy to program
> but it is also clumsy and unreliable.
> - Use the Run method to invoke a batch file of your choice.
> - Use the Exec method to invoke a batch file of your choice.
>
> I suggest you download the help file script56.chm from the Microsoft siteto
> see detailed examples of the various methods.
Though what you say is true, I noted that the OP said 'write' not
'execute' some instructions. There may or may not be a difference in
his/her mind. I didn't want to touch this one because of that
distinction, however.

Tom Lavedas
***********
My System SpecsSystem Spec
Old 07-16-2009   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: Write instructions at the command prompt


"Tom Lavedas" <tglbatch@xxxxxx> wrote in message
news:65c3cfa4-f619-4499-8a17-edbd3b48de75@xxxxxx
On Jul 16, 9:13 am, "Pegasus [MVP]" <n...@xxxxxx> wrote:
Quote:

> "xp" <x...@xxxxxx> wrote in message
>
> news:59D78EEA-807B-4517-923E-9391275B7CB0@xxxxxx
>
Quote:

> > Using Windows XP and Office 2007;
>
Quote:

> > I need to code a command line instruction using a VBScript file; I've
> > coded
> > VBScript for other purposes, but I don't know where to start for
> > something
> > like this. Is there a chance someone could post a generic way to access
> > the
> > command prompt and then write some instructions?
>
Quote:

> > Thanks!
>
> I can think of three ways:
> - Use the Run method to open a Command Prompt, then use the SendKeys
> method
> of the Wscript.Shell object to send your keystrokes. This is easy to
> program
> but it is also clumsy and unreliable.
> - Use the Run method to invoke a batch file of your choice.
> - Use the Exec method to invoke a batch file of your choice.
>
> I suggest you download the help file script56.chm from the Microsoft site
> to
> see detailed examples of the various methods.
Though what you say is true, I noted that the OP said 'write' not
'execute' some instructions. There may or may not be a difference in
his/her mind. I didn't want to touch this one because of that
distinction, however.

Tom Lavedas
***********

----------
I also don't know what the OP means. Any script run from the command line
can echo statements to the console using Wscript.Echo statements. If the
script requires an answer before proceeding, an InputBox statement can be
used. However, if the OP wants to be able to double click a VBS file and
have a command prompt opened with instructions written, the best I can think
of is:
=======
Dim objShell, strCmd

strCmd = "%comspec% /k echo this is my message"

Set objShell = CreateObject("Wscript.Shell")
objShell.Run strCmd, 1, True
======
The user must enter "exit" to close the command prompt window.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Solved Make a command prompt run a command as soon as it opens? General Discussion
No command prompt Vista General
Command prompt "COPY" command not working in brand new Windows Vis Vista file management
command prompt help Vista General
DVD Command Prompt Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46