2

On windows, I have modified a shortcut to an exe file in order to apply a command line argument for that. So, in the properties of the shortcut, I have written

D:\texlive\2018\bin\win32\texworks.exe -stylesheet path\to\mystyle.css

When I double click on the shortcut, I can verify that the argument has been applied. Problem is that when I double click on foo.tex, it will automatically use D:\texlive\2018\bin\win32\texworks.exe and not the argument that I defined.

I even right clicked on foo.tex and changed the "open with" to shortcut path instead of D:\texlive\2018\bin\win32\texworks.exe. Still the argument is missing when I try to open the tex file directly.

Please see the pictures below

enter image description here

and

enter image description here

Any thought?

3
  • Go in to the registry under HKCR\.tex look for the ‘open with’ key and you will see the command used to open .tex files. Add your extra parameters. Log off and log back on to the computer. Nov 25, 2018 at 15:20
  • The .tex folder has one default key with the value of TL.TeXworks.edit.2018. There is a subfolder named OpenWithProglds and there I see a default key which is not set and another key TL.TeXworks.edit.2018 which is empty.
    – mahmood
    Nov 25, 2018 at 18:48
  • Sorry, was pulling that from memory. I wrote some further details in an answer. Nov 25, 2018 at 20:00

1 Answer 1

2

To modify the command used to open a certain file type you will need to go in to regedit.

Perform the following within regedit:

  • Navigate to HKLM\Software\Classes\.tex\OpenWithProgids - Make note of the name of the application listed.
  • Navigate to HKLM\Software\Classes\<Name of Program from previous step>\shell\Open\command

Here, you find a (Default) key with the command line used to open that type of file. Specifically, the <path> and <name> of the executable will be enclosed in double-quotes followed by, usually, a "%1" which will be replaced by the <path> and <name> of the file when you try to open it.

  • Double-click to edit the (Default) key, then move to the end of the line. Add a [space] and then add your additional command line parameters. Any parameter that has a space in it should be enclosed within double-quotes to indicate it is one parameter and not multiple. i.e.

    -stylesheet "path\to\mystyle.css"

Close regedit, then logoff and log back on to your computer and test.

Note: The instructions above aren't universal, but for most third party applications with associated file types you'll see this layout. Some special applications like Microsoft Office do things differently.

You must log in to answer this question.

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