• We've upgraded our forums. Please post any issues/requests in this thread.

Creating Shortcuts with Batch File

Joined
Mar 22, 2008
Messages
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#1
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#2
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#3
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#4
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#5
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#6
What was the error? Maybe it is better to move to a program to do this instead of VBS.
 
Joined
Mar 22, 2008
Messages
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#7
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#8
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

Last edited:
Joined
Mar 22, 2008
Messages
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#9
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#10
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#11
Yes, the icon is in that location. Anyways, I zipped it up and attached it. It's just the icon itself.
 

Attachments

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#12
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#13
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#14
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#15
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#16
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#17
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
554
Likes
25
Location
192.168.0.1
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.02
Cooling EK-Supremacy EVO/EVGA K|NGP|N Hydro Copper/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 2138MHz 11264MB @ 12600MHz GDDR5X Video Cards in 2-Way SLI
Storage Samsung 950 PRO M.2 512GB NVMe V-NAND SSD on Angelbird Wings PX1 PCIe 3.0 ×4 M.2 Adapter
Display(s) Sony BRAVIA EX400 32" Full 1080p HD LCD TV OC 72Hz via Monster M-Series M2000 HDMI HDTV Cable
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 Core 200-12000DPI Laser Gaming Mouse
Keyboard Logitech G19 Gaming Keyboard with Full Color GamePanel LCD
Software Microsoft Windows 7 Ultimate 64-bit Edition with Service Pack 1 build 6.1.7601.17514
#18
Okay gotcha! Thanks again man!
 
Joined
Dec 7, 2005
Messages
947
Likes
115
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)
#19
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
20,902
Likes
9,993
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#20
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.