Re: Execute command line switches from vbs
- From: Jeff C <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Nov 2008 09:00:10 -0800
Thanks so much Tom,
I had been trying numerous ways do do this but breaking the line into
separate pieces and concatenating the strings works!
Very much appreciated. Have a good Thanksgiving
--
Jeff C
Live Well .. Be Happy In All You Do
"Tom Lavedas" wrote:
On Nov 26, 10:23 am, Jeff C <Je...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
I use the following three command lines extensively executing them from *..bat
files or in the “RUN” line of a Wndows Scheduled Task.
Command Line For Access Macro
"Full Path To Access Executable" "Full Path To Access MDB" /x "Name of
Access Macro"
Command Line For Outlook
"Full Path To Outlook Executable" /c "IPM.Note.Name of form" /a "Full Path
To Attachment"
Command Line For Docuanalyzer
"Full Path To Docuanalyzer Program" "Full Path To File" "Full Path To Report
Model" "Full Path To Output"
I have been unsuccessfully trying to build a VBS file that will run them:
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshShell.Run("Full Path To Access Executable" "Full Path To Access MDB" /x
"Name of Access Macro")
set wshShel = nothing
Can someone point me to a reference or assist with a solution?
My goal is to reduce numerous separate scheduled tasks to only several VBS
files that will each hold all the command lines for each operation.
Thanks in advance.
--
Jeff C
Live Well .. Be Happy In All You Do
I don't know of a good reference, other than this group. However, the
advice often given here is to display the string that you are trying
to send to the command line to troubleshoot potential problems. For
example, in a test script try something like this ...
wsh.echo "Full Path To Access Executable" "Full Path To Access MDB" /
x "Name of Access Macro"
(all on one line).
The result is a syntax error because the pieces do not make a valid
VBS literal string. To fix it, the literal above needs to be enclosed
double quotes, so you might try ...
wsh.echo ""Full Path To Access Executable" "Full Path To Access
MDB" /x "Name of Access Macro""
(still one line) but that still causes an error.
The problem is that double quote marks need special treatment. That
is, to include a double quote mark in a literal string, it must be
doubled. So, doubling up the quotes that are to be part of intended
string gives ...
wsh.echo """Full Path To Access Executable"" ""Full Path To Access
MDB"" /x ""Name of Access Macro"""
Ugly, isn't it? And hard to troubleshoot. That's why I tend to use
intermediate string to help break down the problem ...
sExePath = """Full Path To Access Executable"" "
sDBPath = """Full Path To Access MDB"" "
sMacroName = " /x ""Name of Access Macro"""
sCmdLine = sExePath & sDBPath & sMacroName
wsh.echo sCmdLine ' for testing
wshShell.Run sCmdLine, 1, False
Note that I included the quotes in the definitions and spaces between
the parts of the command line in the first two components.
Some other references:
WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
TechNet Script Center Sample Scripts (URL all one line)
http://www.microsoft.com/downloads/details.aspx?FamilyID=b4cb2678-dafb-4e30-b2da-b8814fe2da5a
They might have some other examples that might be helpful, but I
haven't checked recently. But, they're always good to have around,
anyway.
HTH,
Tom Lavedas
***********
http://there.is.no.more/tglbatch/
- References:
- Execute command line switches from vbs
- From: Jeff C
- Re: Execute command line switches from vbs
- From: Tom Lavedas
- Execute command line switches from vbs
- Prev by Date: Re: Vbs script equivalent of the net use */delete /yes command
- Next by Date: Client Script - File Type
- Previous by thread: Re: Execute command line switches from vbs
- Next by thread: Re: Execute command line switches from vbs
- Index(es):
Relevant Pages
|
Loading