Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

simple batch file - Help?

  • 05-06-2003 11:33AM
    #1
    Registered Users, Registered Users 2 Posts: 771 ✭✭✭


    newbie question:

    i have a word document in the same folder as a batch file

    I want the batch file to open/run the document and launch it in
    the default application, for me it's word.

    what's the syntax for the .bat

    exec word.doc


    or something


Comments

  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭Zab


    start word.doc


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    depending on your operating system


    word.doc on it's own may work.

    Otherwise try

    start word.doc


    type 'start /?' for other options.


  • Closed Accounts Posts: 1,719 ✭✭✭Ruaidhri


    for the batch file

    %1

    and the syntax is

    <batchfilename> word.doc

    afaik windows will execute it for you anyway if you provide an extension.


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    At the risk of asking a really dumb question...why would you want to do this?

    jc


  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    <programmes name/path> <filename/path>

    eg word somefile.doc.
    I don't know if it'll work with word, but if you were to use edit (a DOS text editor), it'd go like:
    edit file.txt
    then it'd automatically open file.txt in edit. I don't know if word accepts filenames in the command line...


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 604 ✭✭✭Kai


    if you want to use VB then try :


    shell docName.doc

    and save the file as a .vbs, eg startdoc.vbs`
    This will open it in the Default app for that file.

    or else try
    shell (word.exe docname.doc)

    to mae sure it opens in Word.


Advertisement