Solved

Need VBScript to lauch an executabel with parameters and direct the output to a text file

Posted on 2014-09-25
2
120 Views
Last Modified: 2014-09-26
Here's my command line that works perfectly from a cmd prompt.
C:\BETASys\exf.exe  -c "C:\BETASys\BETASys.md5" > "%USERPROFILE%\AppData\Local\Test\Intergrity_check_results.txt"

However, I can't figure out how to lauch this same command from a VBScript.
May I ask for some help ?
0
Comment
2 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
Comment Utility
Hi, this should work.  Since you're using the DOS only output redirector, you need to initiate cmd.exe.  Using the /c switch means the command windows closes once complete.

Set objShell = CreateObject("WScript.Shell")
strCommand = "cmd /c C:\BETASys\exf.exe  -c ""C:\BETASys\BETASys.md5"" > ""%USERPROFILE%\AppData\Local\Test\Intergrity_check_results.txt"""
objShell.Run strCommand, 1, True

Open in new window


Regards,

Rob.
0
 
LVL 1

Author Comment

by:Accidental Hyper-V Administrator
Comment Utility
Perfect !
I can't thank you enough.

:)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now