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 - dos command

Reply
 
Old 11-11-2008   #1 (permalink)
rogv


 
 

dos command


How can I insert a Dos command in VBS script.
I am trying to move:

from c:/temp/myvbs2.txt c:/temp/folder1

I am not familiar with VBS but it would be nice to know how to do it
using Visual Basic.

Also, I am also trying generate an email once the VBS script ends can
someone please provide some guidance on that.

thank you

My System SpecsSystem Spec
Old 11-11-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: dos command


"rogv" <rvaedex23@xxxxxx> wrote in message
news:7d351b8b-4a72-41e1-ba52-19917dd8979b@xxxxxx
Quote:

>
> How can I insert a Dos command in VBS script.
> I am trying to move:
>
> from c:/temp/myvbs2.txt c:/temp/folder1
>
> I am not familiar with VBS but it would be nice to know how to do it
> using Visual Basic.
>
> Also, I am also trying generate an email once the VBS script ends can
> someone please provide some guidance on that.
>
> thank you
To move a file you should use the File System Object. Download a copy of
script56.chm from the Microsoft site to get the basic stuff. There is no
need to shell out to the Command Prompt.

Have a look here for an example to execute a shell command from within VB
Script:
http://www.microsoft.com/technet/scr...6/hey0817.mspx.

You could use this code to send a message:

schema = "http://schemas.microsoft.com/cdo/configuration/"
Set objEmail = CreateObject("CDO.Message")
With objEmail
.From = "roger@xxxxxx"
.To = james@xxxxxx
.Subject = "Test Mail"
.Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"
.AddAttachment "d:\Testfile.txt"
With .Configuration.Fields
.Item (schema & "sendusing") = 2
.Item (schema & "smtpserver") = "mail.roger.com"
.Item (schema & "smtpserverport") = 25
.Item (schema & "smtpauthenticate") = cdoBasic
.Item (schema & "sendusername") = "roger@xxxxxx"
.Item (schema & "sendpassword") = "rogerspassword"
End With
.Configuration.Fields.Update
.Send
End With


My System SpecsSystem Spec
Old 11-11-2008   #3 (permalink)
Al Dunbar


 
 

Re: dos command


"rogv" <rvaedex23@xxxxxx> wrote in message
news:7d351b8b-4a72-41e1-ba52-19917dd8979b@xxxxxx
Quote:

>
> How can I insert a Dos command in VBS script.
If you are using vbscript, the o/s is windows, not DOS. What you want to do
is execute a native operating system command from a vbscript, correct? If
so, this is done with either the .run method or the .exec method of the
WshShell object:

..run: http://msdn.microsoft.com/en-ca/libr...ky(VS.85).aspx
..exec: http://msdn.microsoft.com/en-ca/libr...4a(VS.85).aspx
Quote:

> I am trying to move:
>
> from c:/temp/myvbs2.txt c:/temp/folder1
If your script is in vbscript, why execute an operating system command to do
something that can be done directly in vbscript using the .move method of
the file object or the .movefile method of the file system object.:

..move: http://msdn.microsoft.com/en-ca/libr...67(VS.85).aspx
..movefile: http://msdn.microsoft.com/en-ca/libr...a6(VS.85).aspx
Quote:

> I am not familiar with VBS but it would be nice to know how to do it
> using Visual Basic.
>
> Also, I am also trying generate an email once the VBS script ends can
> someone please provide some guidance on that.
There are a number of possibilities, but the choice depends somewhat on your
email infrastructure.

/Al


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Running a command from inside a script, command line is corrupted PowerShell
What is the command line command for unzipping files? Vista General
Solved Make a command prompt run a command as soon as it opens? General Discussion
Command Line Ren (Rename) command broken? Vista General
formatting command syntax like get-help or get-command PowerShell


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