2

Im sorry i know this question gets asked alot but i have tried many diffrent things and nothing seems to work. But i am trying to get .tsv files to open with Microsoft Excel. I created a .tsv file on my desktop and at first it showed "test.tsv" with a blank icon. I run the following commands.

assoc .tsv=tsvfile ftype tsvfile="C:\Program Files\Microsoft Office 15\root\office15\excel.exe" "%1"

Now the file has changed, but all that changed is it now shows "test" wnd when i try to open it it want me to choose a program.

I am curently on a windows 8.1 Pro machine if that makes any diffrence.

2 Answers 2

2

Excel will not accept file-associations without a previous manipulation of the registry:

  • Start regedit
  • Navigate to the key
    HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Spreadsheet\Microsoft Excel\Capabilities\FileAssociations
  • Right-click FileAssociations and select New > String Value
  • Name it .tsv
  • Double-click it and set its value to Excel.SLK

Alternatively, you may do the same with a reg add command:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Spreadsheet\Microsoft Excel\Capabilities\FileAssociations" /v ".tsv" /t REG_SZ /d "Excel.SLK" /f

Now you may associate Excel to .tsv files by right-click of any such file and Open with > Choose another app, or by using the Default Programs app.

If you are executing the commands in a batch file, remember to escape the % character, like this:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Spreadsheet\Microsoft Excel\Capabilities\FileAssociations" /v ".tsv" /t REG_SZ /d "Excel.SLK" /f
assoc .tsv=tsvfile
ftype tsvfile="C:\Program Files\Microsoft Office 15\root\office15\excel.exe" "%%1"
2
  • i have been able to associate it before this with the open with. But i need command line cause i got a machine that keeps changing the association back to notepad. I want to make a script to run daily to ensure this never happens again. Dec 8, 2018 at 12:28
  • I added the reg command for batch.
    – harrymc
    Dec 8, 2018 at 12:35
0

Ok, here is the current update. Making a little bit of progress. Here is my current code. The icon now changes to excel, but it only opens excel like a fresh worksheet. Not the info that is in the file.

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Spreadsheet\Microsoft Excel\Capabilities\FileAssociations" /v ".tsv" /t REG_SZ /d "Excel.SLK" /f
assoc .tsv=tsvfile
ftype tsvfile="C:\Program Files\Microsoft Office 15\root\office15\excel.exe" "%1"

Ok, i think i got the biggest part figured out now. Now my only issue is when i run the above command as a .bat file. that very last "%1" does not get added. After the script runs all that is there is "". so for some reason it is dropping that last peramiter off. so just need to figure out a way to keep it there.

1
  • Solution in my answer.
    – harrymc
    Dec 8, 2018 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .