• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Creating Shortcuts with Batch File

Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
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

Batch File Example (for Windows Notepad):
Code:
@echo off
cscript createLink.vbs "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe"

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:



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! :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.
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Working Directory needs to match the directory of target which would be "C:\Windows\System32"

You set the icon via: objShortcut.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13

Path is obvious, the number is the index of the icon inside the DLL, EXE, or ICO. You should be able to use Greenfish Icon Editor Pro to see the indices in an ICO file. You can use Resource Hacker to view the indicies in a DLL or EXE.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
Working Directory needs to match the directory of target which would be "C:\Windows\System32"

You set the icon via: objShortcut.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13

Path is obvious, the number is the index of the icon inside the DLL, EXE, or ICO. You should be able to use Greenfish Icon Editor Pro to see the indices in an ICO file. You can use Resource Hacker to view the indicies in a DLL or EXE.

How would the VB script look like with that line you mentioned added into it? I didn't create this VB Script and I'm not very familiar with using it. I'm more familiar with using Batch Command Files. I've created my very own custom icons for practically every program on my system. I usually use Restorator 2007 to edit the icons themselves in the EXE files for the programs but there are some program's that apparently won't work if doing this. So for the one's that won't work with that method, I place the icon(s) in the Pictures folder and then make it hidden after assigning it to the shortcut.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Code:
set objWSHShell = CreateObject("WScript.Shell")
set objFso = CreateObject("Scripting.FileSystemObject")

sShortcut = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(0))
sTargetPath = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(1))
sWorkingDirectory = objFso.GetAbsolutePathName(sTargetPath)

set objSC = objWSHShell.CreateShortcut(sShortcut)
objSC.TargetPath = sTargetPath
objSC.WorkingDirectory = sWorkingDirectory
objShortcut.SetIconLocation(sTargetPath, 9)
objSC.Save
Or if you want to control the icon index from batch:
Code:
set objWSHShell = CreateObject("WScript.Shell")
set objFso = CreateObject("Scripting.FileSystemObject")

sShortcut = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(0))
sTargetPath = objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(1))
sWorkingDirectory = objFso.GetAbsolutePathName(sTargetPath)

set objSC = objWSHShell.CreateShortcut(sShortcut)
objSC.TargetPath = sTargetPath
objSC.WorkingDirectory = sWorkingDirectory
objShortcut.SetIconLocation(sTargetPath, WScript.Arguments.Item(2))
objSC.Save
Batch:
Code:
@echo off
cscript createLink.vbs "C:\Users\Administrator\Desktop\Notepad.lnk" "C:\Windows\System32\notepad.exe" 9
 
Last edited:
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
Tried both of the VB Scripts that you provided and adding the 9 switch to the batch file but neither was able to create a shortcut to my desktop.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
What was the error? Maybe it is better to move to a program to do this instead of VBS.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
No error, when I run the BAT file the CMD prompt shows and looks like it did stuff. But no shortcut on my Desktop.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Threw a program together quick for you. It is attached with source in the other. Use it in place of your VBScript.

It supports:
CreateShortcut [save shortcut] [path to run]
CreateShortcut [save shortcut] [path to run] [icon index]
CreateShortcut [save shortcut] [path to run] [icon file]
CreateShortcut [save shortcut] [path to run] [icon file] [icon index]

If "icon index" is missing, it assumes 0. If "icon file" is missing it assumes "path to run." It doesn't presently support arguments to be added to the shortcut nor modifying the working directory (always assumes same directory as "path to run").

Requires .NET Framework 4.0 to run. Will run natively on 32-bit and 64-bit versions of Windows.
 

Attachments

  • CreateShortcut.exe
    12 KB · Views: 1,389
  • CreateShortcutSource.zip
    11.8 KB · Views: 985
Last edited:
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
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"

Thanks man! :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"

It created the shortcut but didn't change the icon.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Are you sure Notepad.ico exists in that location? If it does, maybe you should zip it up and attach it so I can try myself and see if I can catch an error.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
Yes, the icon is in that location. Anyways, I zipped it up and attached it. It's just the icon itself.
 

Attachments

  • Notepad.zip
    18.8 KB · Views: 578

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
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.

Yeah, refreshing did it, well not exactly, more like updated it lol. Thanks man you really saved me a lot of time with this, much appreciated! :D
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
How would I assign specific icon that's inside an EXE within the program itself?
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
That's what the icon index is for. This one:
CreateShortcut [save shortcut] [path to run] [icon index]

You can use Resource Hacker to view the indices. Or you can just guess and check.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
So for the icon index, should I just set the path to the EXE followed by "\[x]" (x being the index of the specific icon)?
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
No, example: CreateShortcut "C:\shortcut.lnk" "C:\program.exe" 6

That would set icon index 6 in program.exe to the icon in shortcut.lnk. No slash and no quotes, just a number.
 
Joined
Mar 22, 2008
Messages
580 (0.10/day)
System Name X-Class MKII
Processor Intel Core i7-6950X Extreme Edition 4.60GHz 25MB Cache 14nm LGA2011-3 Broadwell-E 10-Core Processor
Motherboard EVGA Intel X99 Classified Dual Quad-Channel DDR4 Socket LGA2011-3 E-ATX Motherboard on BIOS v2.09
Cooling BP Summit M CPU WB/BP EVGA K|NGP|N FCWB/Nemesis 480GTR/Nemesis 560GTR/MMRS 150mm/Swiftech MCP655
Memory Corsair Dominator Platinum 128GB (8×16GB) @ 2800MHz 14-16-16-36 DDR4 PC4-22400 Memory Kit
Video Card(s) EVGA nVidia GeForce GTX 1080 Ti K|NGP|N 2139MHz 11264MB @ 12992MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 970 PRO M.2 1TB NVMe V-NAND SSD on AquaComputer kryoM.2 PCIe 3.0 ×4 M.2 Adapter
Display(s) LG 34GN850-B 34” UltraGear 21:9 WQHD Nano IPS 1ms 144Hz HDR Gaming Monitor
Case CaseLabs MAGNUM SMA8 Gunmetal Single Wide Full-Tower Chassis with Custom Smoke Window Panel
Audio Device(s) Creative Sound Core3D On-Board 5.1 Surround Sound Quad-Core Audio Processor
Power Supply Corsair Professional Series AX1500i 1500-Watt 80+ TITANIUM Fully-Modular Digital Power Supply Unit
Mouse Logitech G502 PROTEUS SPECTRUM Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 10 Professional 64-bit
Okay gotcha! Thanks again man!
 
Joined
Dec 7, 2005
Messages
972 (0.14/day)
System Name GRAYSCALE\Butterfly
Processor Intel Core i7 8700k @ 5.2Ghz\Intel 4690k
Motherboard ASUS Maximus X Hero \Asus Z97 Maximus Hero VI
Cooling Custom Water\Stock
Memory 2x8GB G.Skill RGB DDR4-3200 \2x8GB Crucial Ballistix DDR3-1600
Video Card(s) NVidia Titan Xp w/ EK Block \ MSI Reference GTX 780
Storage 512GB Samsung 960 PRO (M.2)\128GB OCZ Vertex 4 + 500GB WD Black
Display(s) Asus PG278Q ROG Swift\Acer x213h 21.3'' 1920x1080 LCD
Case Thermaltake P3 Core\NZXT S340
Audio Device(s) Integrated w/ AKG K702 65th Anny's\Integrated
Power Supply Corsair HXi 1000 \Corsair HX850
Mouse Logitech G502 Proteus Spectrum\2014 Razer Naga
Keyboard Ducky One TKL RGB
Software Windows 10 Pro (x64)\Windows 10 Pro (x64)
This little program just saved me a whole heap of time with pushing out some new software in a school. Until our AD is cleaned up/organized pushing something like this out via GPO would have been a nightmare... while I still have to have my guys touch every machine, using this program allows them to just run a simple script and wait for the okay. Without this I would still be trying to make a VB script work.

Thanks so much!
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
FYI, here is batch code to make Vista and newer demand admin access:
Code:
@echo OFF
:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------
If you need to use it, place all of the administrative batch lines after this and they'll run with admin rights. Basically, it elevates the batch to administrator access and then passes those administrator credentials to all subsequent applications.
 
Top