Windows 10: How to run a Windows Apps shortcut in a batch file?

Discus and support How to run a Windows Apps shortcut in a batch file? in Windows 10 Gaming to solve the problem; Hi,I'm trying to open a couple of programs OBS and the Minecraft Launcher in a batch file that I will then make a shortcut for so I can launch them... Discussion in 'Windows 10 Gaming' started by Owen Russell, Dec 18, 2023.

  1. How to run a Windows Apps shortcut in a batch file?


    Hi,I'm trying to open a couple of programs OBS and the Minecraft Launcher in a batch file that I will then make a shortcut for so I can launch them with one press of a key on my Num Pad. I was wondering how I could open the Minecraft Launcher in this batch file? The issue that I am having with this is that I cannot copy the path of the launcher file. I have the OBS file put in the batch file, but I just can't figure out how to open the Minecraft Launcher using the batch file.

    :)
     
    Owen Russell, Dec 18, 2023
    #1
  2. Flava0ne Win User

    Creating Shortcuts with Batch File

    I've created a Batch file which calls on the following VB Script to be able to create a shortcut to my desktop:

    VB Script (named createLink.vbs):
    Code: set objWSHShell = CreateObject("WScript.Shell") set objFso = CreateObject("Scripting.FileSystemObject") ' command line arguments ' TODO: error checking sShortcut = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(0)) sTargetPath = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(1)) sWorkingDirectory = objFso.GetAbsolutePathName(sShortcut) set objSC = objWSHShell.CreateShortcut(sShortcut) objSC.TargetPath = sTargetPath objSC.WorkingDirectory = sWorkingDirectory objSC.Save[/quote] Batch File Example (for Windows Notepad):
    Code: @Echo off cscript createLink.vbs "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe"[/quote] But after creating the shortcut using this method, I'm not able to assign a custom icon for the shortcut. I get the following error message when trying to do so:


    How to run a Windows Apps shortcut in a batch file? [​IMG]


    Any help and ideas on what I need to put into the VB Script and/or Batch File to be able to do this would be greatly appreciated! *Big Grin How to run a Windows Apps shortcut in a batch file? :D

    Also, I know that I can simply do this by going to Start Menu\All Programs\Accessories\ right-clicking on Notepad and selecting Send to\Desktop (create shortcut). Easy enough for creating a single shortcut. But I need to create several multiple shortcuts and using this Batch/VBS method would really save me a lot of time in doing so.
     
    Flava0ne, Dec 18, 2023
    #2
  3. Flava0ne Win User
    Creating Shortcuts with Batch File

    So basically my Batch File will now look like this:

    Code: @Echo off CreateShortcut.exe "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe"[/quote] Thanks man! *Big Grin How to run a Windows Apps shortcut in a batch file? :D This does exactly what I want done and I'm able to customize the icon for the shortcut without problems. But I'm not quite sure how to use the [icon file] portion you mentioned that it supports. I tried the following Batch File:

    Code: @Echo off CreateShortcut.exe "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe" "C:\Users\Administrator\Pictures\Notepad.ico"[/quote] It created the shortcut but didn't change the icon.
     
    Flava0ne, Dec 18, 2023
    #3
  4. How to run a Windows Apps shortcut in a batch file?

    Creating Shortcuts with Batch File

    Hmm, I just tried it and it worked fine. Maybe try running the batch as administrator? Also, right click on the desktop after the shortcut is created and click Refresh.

    If the file in the third parameter doesn't exist, it assumes the icon is in the application.
     
    FordGT90Concept, Dec 18, 2023
    #4
Thema:

How to run a Windows Apps shortcut in a batch file?

Loading...
  1. How to run a Windows Apps shortcut in a batch file? - Similar Threads - run Apps shortcut

  2. How to run a simple batch file in windows 10

    in Windows 10 Gaming
    How to run a simple batch file in windows 10: For years, from Windows3.1 to Windows7 I have been able to run simple batch files like something.bat It always executed without any problems.Fast forward to Windows10 pro 22H2 , it does not work anymore : On clicking the 'something.bat' , it shows the same as 'something.txt'...
  3. How to run a simple batch file in windows 10

    in Windows 10 Software and Apps
    How to run a simple batch file in windows 10: For years, from Windows3.1 to Windows7 I have been able to run simple batch files like something.bat It always executed without any problems.Fast forward to Windows10 pro 22H2 , it does not work anymore : On clicking the 'something.bat' , it shows the same as 'something.txt'...
  4. How to run a simple batch file in windows 10

    in Windows 10 Network and Sharing
    How to run a simple batch file in windows 10: For years, from Windows3.1 to Windows7 I have been able to run simple batch files like something.bat It always executed without any problems.Fast forward to Windows10 pro 22H2 , it does not work anymore : On clicking the 'something.bat' , it shows the same as 'something.txt'...
  5. How to run a Windows Apps shortcut in a batch file?

    in Windows 10 Network and Sharing
    How to run a Windows Apps shortcut in a batch file?: Hi,I'm trying to open a couple of programs OBS and the Minecraft Launcher in a batch file that I will then make a shortcut for so I can launch them with one press of a key on my Num Pad. I was wondering how I could open the Minecraft Launcher in this batch file? The issue...
  6. How to run a Windows Apps shortcut in a batch file?

    in Windows 10 Software and Apps
    How to run a Windows Apps shortcut in a batch file?: Hi,I'm trying to open a couple of programs OBS and the Minecraft Launcher in a batch file that I will then make a shortcut for so I can launch them with one press of a key on my Num Pad. I was wondering how I could open the Minecraft Launcher in this batch file? The issue...
  7. How to batch-resolve file shortcuts turn shortcuts into the files they link to ?

    in Windows 10 Network and Sharing
    How to batch-resolve file shortcuts turn shortcuts into the files they link to ?: Hi! I'm considering to use file shortcuts lnk files for my documents in order to allow a single file to occur in multiple folders - as a real file in one folder and as file shortcuts in other folders. However, I will have to export folders with many of these file...
  8. how to add powershell batch file shortcut to taskbar

    in Windows 10 Support
    how to add powershell batch file shortcut to taskbar: Hi I have several batch files which I've created shortcuts for, and added to my windows taskbar. I now have a new batch file which contains some powershell which instructs pc to switch off screen. Please can anyone advise why Windows won't let me place this shortcut on the...
  9. how to add powershell batch file shortcut to taskbar

    in Windows 10 Performance & Maintenance
    how to add powershell batch file shortcut to taskbar: Hi I have several batch files which I've created shortcuts for, and added to my windows taskbar. I now have a new batch file which contains some powershell which instructs pc to switch off screen. Please can anyone advise why Windows won't let me place this shortcut on the...
  10. How to run batch file with powershell

    in Windows 10 Network and Sharing
    How to run batch file with powershell: I created a basic batch file that uses "net share" to share a local path. I saved the batch file. When I double click the file I get "access is denied"... note, I am logged on as a admin. Anyways... I figure it has to be run using power shell. I do not know much about...