Batch File 'Open With' Command?

Discussion in 'All other topics' started by Sankou134, May 8, 2009.

  1. Sankou134

    Sankou134 Member

    Joined:
    Jul 22, 2006
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    I've been working on a fairly complex batch file project and I ran into an annoying snag. I can't figure out if there is a way to open files with a specified program through a batch file.

    For example, the command could be-

    Start sample.jpg

    Instead of opening it with the default program, I want to open it with a specific program. I need to do this without changing the default associated program.

    Any ideas...?
     
  2. Sankou134

    Sankou134 Member

    Joined:
    Jul 22, 2006
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
  3. vyper0

    vyper0 Member

    Joined:
    Dec 14, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    11
    give me a little more... what type of file and what do you want to open it with.

    just as an example... if you want to open a txt file in word instead of notepad you can do

    Code:
    winword filename.txt
    
    or open a jpg in firefox

    Code:
    firefox D:\Pictures\2005\28state.jpg
    
    depending on the app you may need to specify the complete path and dont forget quotes if there are spaces or special characters in the file name/path.

    if you have a list of files you can save it in a text file and then carry out the command on each file name in the list.txt

    Code:
    @echo off
    FOR /F %%i in (list.txt) do (
    echo updating %%i
    firefox %%i
    )
    
    you should look at some other forums for scripting help...
    *the scripting guys
    *appdeploy.com
    *autoit.com
     

Share This Page