user6492738
user6492738

Reputation:

Create executable to run a shortcut? Similar to a .bat file but a .exe?

I have a keyboard with 6 keys I can assign pretty much anything to, including opening apps.

I want to be able to open Spotify with one of these keys, but I have to have to link a .exe to to the key - no other file type will work.

I have Spotify downloaded from the Windows Store, so it's stuck under the WindowsApp folder in Program Files, which means I can't access it directly. Even if I create a shortcut and put it on the desktop, it's not an .exe, it a .lnk.

I'm wondering if there's a way to create a .exe file that will run the Spotify shortcut that I have on my desktop, or any app at all.

I know it sounds redundant - creating a .exe to run a .exe - but I can't access the WindowsApp folder to directly link it to my keyboard. I know a batch file would work, but I can't link a .bat to my keyboard, only .exe.

I don't have experience creating executables, so I don't even know where to start and I haven't been able to find anything online.

Upvotes: 2

Views: 23822

Answers (2)

Alex Baban
Alex Baban

Reputation: 11732

If you wish to try this yourself, you will need to:

  • install a compiler
  • write the code
  • use the compiler to create an executable

While this might sound complicated for somebody without experience, in this case is not that hard.


Here is how you can do it using the very simple PureBasic compiler:

  • download and install the PureBasic compiler from this website

  • launch the PureBasic IDE and write this code:
    • in this example I'm making an executable which will launch Sublime Text, so change the path to your Spotify executable

```

; // make this a console program
OpenConsole()

; // specify path to another executable
pathToExecutable$ = "C:\Program Files\Sublime Text 3\sublime_text.exe"

; // use RunProgram to launch another executable
x = RunProgram(pathToExecutable$)

```


  • after you enter the code, click on File menu at the top, then click on Save As..., you will be prompted for a name for your source code file.
  • select a location, for example your Desktop then, enter a name for the file, for example proxy. (this will create a proxy.pb file)

  • last step, create the proxy.exe executable
  • click on Compiler menu, then click on Create Executable...
  • select location (again I recommend your Desktop), then enter a name for the executable, again for example proxy and then click on Save (this will create proxy.exe on your Desktop)

You can move your new created executable anywhere, it's portable.

Good luck!

Upvotes: 4

Drew Snow
Drew Snow

Reputation: 177

This is Stack Overflow where you can do it yourself so here is how.

  1. Download a BAT to EXE convertor from here or here.

  2. Make a batch file to start the program of your choice. (Code would look like the following) @start "" "C:\users\JimithyJones\Desktop\Spotify.exe" && exit

  3. Convert it to an EXE with one of the previous programs. WARNING! Sometimes they are detected as malicious files because batch files have the capability to do harm to your computor.

  4. Assign the new EXE to your hotkeys.

Upvotes: -1

Related Questions