Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
MicroStation
  • Product Communities
  • More
MicroStation
[Archived] AskInga Wiki Using MSBATCH for command line processing
    • Sign in

    • -AskInga
      • +3D MicroStation
      • +AccuDraw Secrets
      • +Animation - Rendering
      • +Behind The Scenes
      • +Cells
      • +Colours
      • +Conversion - Translation
      • +Coordinate Input
      • +Design Settings
      • +Dimensions
      • +DWG
      • +EDG
      • +Element Manipulation
      • +Element Properties
      • +Element Selection
      • +Freeware - Shareware
      • +Interface Look And Feel
      • +Internet - E-Links - Links
      • +Keyins
      • +Levels
      • +Line Styles
      • +Models
      • +MSM Archive
      • +Other
      • +Presentations
      • +Printing - Plotting
      • +Programming - Automation
      • +Rasters - Images
      • +References
      • +Tags - Data Fields - Fields
      • +Text - Fonts - Annotation
      • +Views
      • -Windows - Interacting With
        • All about thumbnail generation
        • Bring up the system calculator in MicroStation
        • Close modal dialogs with ESC
        • Expand Element Info with an asterisk
        • Finding text content in DGN files using Windows Search
        • Google Tip - Search a website easier
        • Group the display of files in the MicroStation Manager
        • How to determine MicroStation's installation date
        • Maximize MicroStation when started from desktop
        • Move a dialog off your screen without docking
        • Open Windows Explorer and navigate to folder of active file from MicroStation
        • Right click when dragging and dropping
        • Running an external application from a read-only file
        • Start an application and keep MicroStation running
        • Start an application and suspend MicroStation
        • Start an application from within MicroStation
        • Start MicroStation without the splash screen
        • Stop that annoying Restart Now - Restart Later dialog
        • Strip text formatting when copying between applications
        • Suspend MicroStation open a DOS window and start another application
        • Use keyboard shortcuts to launch your programs
        • Using a system variable for your license folder
        • Using MSBATCH for command line processing
        • Using MSBATCH to replace cells from Windows Explorer
        • Windows Tip - customize My Documents
      • +Workspaces - Configuration
    • graffiti

     
     Questions about this article, topic, or product? Click here. 

    Using MSBATCH for command line processing

    AskInga logo

    Original Article Date: Feb 14, 2001

    Batch process can be run directly from the system command line by using a external process called MSBATCH. With this utility you can do several things depending upon the version of MicroStation you're using. For example, with V8 you can convert raster files, merge files, save to DWG, and replace cells.
    2003-11-19 Updated for clarity.
    2007-01-09 Reviewed and updated as necessary.
    2007-05-14 Updated V8 content.

    MSBATCH is a delivered utility that runs from the command line and translates multiple files from one format to another. Although most commonly used with V7 MicroStation for converting AutoCAD drawing files into the V7 design file format, MSBATCH can also be used to:

    Action

    Application Version
    Import / Export: DWG, DXF, and DXB dwgin, dwgout V7 Only
    Import / Export: CGM cgmin, cgmout V7 Only
    Import / Export: IGES igesin, igesout V7 Only
    Import / Export: GRD grdin, grdout V7 Only
    Import: VersaCAD 386 vcadin V7 Only
    Convert 2D to 3D and 3D to 2D cnvdgn V7 and V8
    Convert Raster Images to other formats rastconv V7 and V8
    Merge Source file(s) into a destination file merge V7 and V8
    Replace Cells repcell V7 and V8
    Execute a Batch Process Job File (BPRC) Batch Process V8
    Exceute a Batch Conversion Job (BCNV) Batch Convert V8

    Watch that syntax!
    MSBATCH is run from the directory that contains the executable and typically follows this syntax: MSBATCH [application] option1 option2 option3…. Although the syntax appears to be quite simple, the following should be kept in mind:

    • Run MSBATCH from the directory that contains the executable. In MicroStation J that would be: ..\Bentley\Program\Microstation\
    • MSBATCH will use the last settings found in the DWG/DXF Import/Export dialog box – but that these can be overridden by command line options.
    • Wildcards (*) and (?) can be used for specifying file names.
    • All output directory parameters (outdwg, outdgn, o, outgrd and outname) must end with a backslash. For example, outdwg:c:\temp\*.dwg will output all files to single dwg files, but outdwg:c:\temp will output all files into one file called temp.dgn
    • Utilize MicroStations configuration variables or use full paths when specifying the file names.
    • The entire MSBATCH statement must be keyed in on one line.
    • Depending upon your operation system, an MSBatch statement which exceeds the DOS 128 character limit it may not run as expected. Should this occur, create an ASCII text file with extension of .bat and type the entire MSBATCH statement on one line. To execute this MSBATCH statement, simply key in the batch file name from the command prompt.


    The Command Line Options:
    With some of the translators it's possible to obtain a list of the available command line options by keying in MSBATCH [application] from the system command prompt. This is true for: dwgin, dwgout, cgmin, cgmout, igesin, igesout, cnvdgn and repcell - although this isn't the case for all versions.

    Entering this keyin will display a table showing the valid parameters as well as an example of the syntax to be used.

    For instance, by keying in MSBATCH DWGIN, you will be presented with the following information in a DOS window:

    GRD Import:
    In MicroStation V7 the grdin translator doesn't show the available options. In the event that you'd like to use MSBATCH to convert to this format, use following syntax:
    msbatch grdin [option1 option2 option3...] where:

    infile: [filename] Specifies files for import, overrides MS_GRDIN
    outgrd: [filename] Specifies output file name and directory, overrides MS_DGNOUT
    settingsfile: [filename] Specifies settings file; overrides MS_GRDINSET

    For example, to convert GRD Files in \temp to DGN files in \dgn, the command would read:
    msbatch grdin infile:c:\temp\*.grd outgrd:c:\dgn\


    GRD Export:
    In MicroStation V7 the grdout translator doesn't show the available options. In the event that you'd like to use MSBATCH to convert to this format, use following syntax:
    msbatch grdout [option1 option2 option3...] where:

    infile: [filename] Specifies files for export, overrides MS_DEF
    outgrd: [filename] Specifies output file name and directory, overrides MS_GRDOUT
    settingsfile: [filename] Specifies settings file; overrides MS_GRDOUTSET

    For example, to convert DGN Files in \dgn to GRD files in \temp, the command would read:
    msbatch grdout infile:c:\dgn\*.dgn outgrd:c:\temp\


    Raster Image Conversion:
    Although you can use MSBATCH to handle multiple images, you may obtain better results and more control over output settings by using the Batch Conversion option delivered with the Raster Manager. Please refer to the delivered MicroStation HELP file for the specific syntax and available options.


    Merging Design Files Together:
    Let's say you need to merge a dozen or so files into one single destination file. You could attach them as reference files and then use the Fence Copy tool..but that method has it's problems. First of all it can be extremely inefficient and of course, there's always the risk of duplicating your active design file elements. With that in mind, let's take a look at using MSBATCH to merge files together.

    Say, we want to merge the entire contents of source1.dgn, source2.dgn and source3.dgn into dest.dgn.
    You can use the following syntax:
    msbatch merge [destination_filename] [source_filename_1]... [source_filename_n]

    For example, in both MicroStation V7 and V8, you'd use the following:
    msbatch merge dest.dgn source1.dgn source2.dgn source3.dgn

    Of course – the same results can be obtained by executing Merge from the MicroStation Manger > File menu.


    Replacing cells:
    To replace cells (excluding orphan cells) from the system command line, enter
    msbatch repcell.ma [DGN_file] [cell_library] [y | n] [cell_to_replace] [replacement_cell] where:

    DGN_file is the DGN file on which to operate,
    cell_library is the cell library that contains the replacement cell,
    y keeps attributes,
    n does not keep attributes,
    cell_to_replace is the name of the cell in DGN_file to replace,
    replacement_cell is the name of the replacement cell in cell_library.


    Convert 3D to 2D
    MSBATCH can be used to quickly convert 3D files to 2D or vice versa. To do so, use the following syntax:
    msbatch cnvdgn inname: outname:

    For example, to convert all files in C:\3D\ and place the resulting files in C:\2D\ the command would be as follows:
    msbatch cnvdgn inname:c:\3d\*.dgn outname:c:\2d\

    Remember to include the trailing back-slash at the end of the outname. In addition, the file names can't have any spaces and the output files can not be written to the same folder as the input files.



    Batch Process Job File:
    MSBATCH can also be used to kick off a MicroStation V8's Batch Process Job file by using this syntax:
    msbatch batchprocess [batch_process_job_file_specification]
    Note, when using MSBATCH to kick off a VBA application, ensure that the command includes MDL Load ustnvba at the beginning.
    With thanks to Russ Webber for providing this information.


    Batch Conversion Job File:
    You can run a job saved in a batch conversion job file (BCNV) directly from the system command line by using MSBATCH and the following syntax:
    msbatch batchconvert [batch_conversion_job_specification]


    Watch those settings:
    Before bulk processing any files, it's important to have fine-tuned your option settings and to have a good idea of what your end results are going to be. It's strongly suggested to test one or two files first and tweak the necessary settings until you have satisfactory results. After all, it would be a shame to process hundreds of files only to realize after the fact that your settings were incorrect.

    In addition, you many experience a limit to the number of files that can be included in one batch when using MSBATCH. This limit is related to the amount of system resources available and will vary from system to system. Typically, the more physical memory and swap space available, the more files you can include in a single batch process.


    Need more info?
    File Portability/Translation Guide
    Using MSBATCH
    And of course the delivered documentation.

    AskInga Article #52

    • Askinga
    • ConversionTranslation
    • Article
    • Windows Interacting with
    • Share
    • History
    • More
    • Cancel
    • Danielle Schutz Created by Bentley Colleague Danielle Schutz
    • When: Thu, May 22 2008 10:12 AM
    • Phil Chouinard Last revision by Phil Chouinard
    • When: Fri, Mar 2 2012 7:24 AM
    • Revisions: 9
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies