Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:17:52+00:00 2026-05-22T20:17:52+00:00

I am new to VB Script, but since it is straight forward, so I

  • 0

I am new to VB Script, but since it is straight forward, so I grabbed two fragments of code from the web and combine them into one in order to do my task.

Basically what I want is to run an application called “MapForce.exe” and produce an output file, then create a new directory and copy this file to this new directory too.

The code is straightforward:

'This is the line to call MapForce.exe and produce output file. 
createObject("wscript.shell").exec "C:\Program Files\Altova\MapForce2011\MapForce.exe 834toASCII.mfd /BUILTIN  /LOG ACS.log" 

'These are the lines to copy that output file to the new folder:

 sourceDir = "C:\Documents and Settings\Robert\test\result.txt" 
 destinationDir = "C:\Documents and Settings\Robert\test\" 
 const OverwriteExisting = True

 strDirectory = destinationDir & replace(Month(date),"/","_") & " TOU" 
 Set fso = CreateObject("Scripting.FileSystemObject")

 if not fso.FolderExists(strDirectory) then 
 Set objFolder = fso.CreateFolder(strDirectory) 
 end if
 fso.CopyFile sourceDir & "*.*", strDirectory & "\", OverwriteExisting 

Now it works: Mapforce.exe gets run, output generated, new folder created and a file copied to the new folder. But the question is, since the MapForce will take a longer time to finish and produce the newest output file, so line 1 takes longer time to finish, however, the remaining lines of doing copying task don’t wait for it to finish, so the file gets copied in the new folder is always the old one, not the newest one generated by the application.

To put it in another way, the remaining lines hurry to finish the task without caring whether the first line (which runs the MapForce application) finishes or not.

So I wonder if experts could give me advice on how to force the remaining lines to wait for the first line gets finished and newest output gets generated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:17:53+00:00Added an answer on May 22, 2026 at 8:17 pm

    You could use the WshShell.Run method.

    1. The first parameter (REQUIRED) is the executable (including parameters).
    2. The second parameter (OPTIONAL) specifies the window style.
    3. The third parameter (OPTIONAL) specifies whether the scripts waits for the command to complete before continuing.

    A sample:

    Dim oShell
    Set oShell = WScript.CreateObject("WScript.Shell")
    returnCode = oShell.Run("Your.exe Param1 Param2", 1, True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We were running Tarantino in a Nant build script but we're getting some new
Call me a 'n00b', but I am new to creating Script Controls. I want
Pretty simple question (probably) but I guess since im new to python im not
I'm very new to python, and I wanted to compile my code into a
Why does the following JavaScript script open a new window, but fails to scroll
Is there a way in Firebug to start a new script file to apply
I have a migration that runs an SQL script to create a new Postgres
As I understand (Perl is new to me) Perl can be used to script
Code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Unusual Array Lengths!</title> <script type=text/javascript> var arrayList = new Array();
I was using an mxml class but since i need to pass some properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.