How to run MS Excel 2007 from a batch file?

18,567

Solution 1

Just add this line to your batch file:

  • START "name of spreadsheet.xls"

This will use the default file association to open the file. If you need a specific version though, then you'll need to find the appropriate .EXE file which might be under a sub-directory called "Common" or "Common files" which should be somewhere under "C:/Program Files/" or "C:/Program Files (x86)/" (stuff is often scattered between both of these as applications are slowly transitioning from 32-bit to 64-bit).

Depending on the default file assocation will ensure that your batch file is portable, so you should prefer to use this approach if you can.

Solution 2

If you want to start excel on its own, you can use.

  Start Excel

You should be able to find the exact path by opening a command prompt and typing

 reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe"
Share:
18,567

Related videos on Youtube

Rolnik
Author by

Rolnik

Updated on September 18, 2022

Comments

  • Rolnik
    Rolnik over 1 year

    I can't find a proper *.exe for Excel in the usual places:

    • "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office
    • "c:\program files\microsoft office\office12\excel.exe"

    Does anybody know where I would find the Excel executable for a Windows Vista machine? For that matter, also invoke Excel to open an existing *.xls file using a batch file?

    Incidentally, the Shortcut for Excel shows "target:" to be

    Microsoft Office Professional Hybrid 2007

    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 about 13 years
      If your Windows install is 64-bit then Excel.exe will be in "<drive>:\Program Files (x86)\"
  • Joey
    Joey about 13 years
    Note that if your file name needs quotes due to spaces or shell metacharacters, you'll need an empty set of quotes first: start "" "file name with spaces.xls"