3

I am using Windows in parallel with Linux again, and I've got all the Linux habits and reflexes, without which I feel very frustrated.

For example, how to create a file to launch a terminal with a given command, like those that come in a .desktop file after the Exec= line?

Could then a such file act as an "app" so that it is associated with a file-type? (so that a video or stream, for example, is then treated/downloaded/converted in terminal?)

0

1 Answer 1

4

Don't you notice all the icons to apps on Windows desktop are *.lnk files? Exactly the same as desktop icons on Ubuntu representing by *.desktop. Just open the console on desktop and run dir and you'll see. They're shell links and called shortcuts on Windows. They don't only work for apps but actually do a lot more thing so not entirely equivalent, but for basic purposes of running commands then they're almost the same

See also

Could then a such file act as an "app" so that it is associated with a file-type? (so that a video or stream, for example, is then treated/downloaded/converted in terminal?)

Windows doesn't care about any app because any file type can be associated with any commands, including VBS, batch or PowerShell scripts. The shell simply runs the commands specified in registry, specifically the HKEY_CLASSES_ROOT\SystemFileAssociations hive. For this purpose you don't need to create a shortcut unless you want to specify an icon, or other special properties like compatibility mode or keyboard shortcuts. Just a simple script is enough. In fact the command in the shortcut is only for you to click and run. Normally you'll specify exactly the command you want to associate with each file type, i.e. copy the same command in the script, or simply call the script from the shortcut

In cmd you can run assoc or ftype to see, or follow this for PowerShel. Check the below questions for some examples

For more information run assoc /? and ftype /? to read their manuals

1
  • You have given me a great answer here! I intend to learn how to use shortcuts too, and add context menu actions to the file explorer. I don't know why I never felt I could get more knowledge in Windows the way in Linux that comes rather naturally. But I feel that's a good starting point for me. Thanks!
    – cipricus
    Apr 13 at 16:29

You must log in to answer this question.

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