Solved Batch: To generate a working shortcut...

September 4, 2011 at 09:44:49
Specs: Windows 7, AMD 64 2GB
Dear Friends,
There has been an extensive discussion on the issue about "how to generate a valid shortcut for the Files on a Removable Drive/ Portable Drives (And the Virtual Disks)...

The problem was, every time you connect/mount the drive, it may assign a new Drive Letter, rendering the old shortcut dead...
Setting a permanent drive letter to all External/Virtual Drive could be a solution, but I don't prefer it... Please no discussion on such solution any more...

What I need is a batch script, which works like this:

STEP 1: Check if D:/MyGame.exe exists
STEP 2: If exists, open it
STEP 3: If Does not exist, Check if E:/MyGame.exe exits
STEP 4: If exists, open it
STEP 5: If Does not exist, Check if F:/MyGame.exe exits
STEP 6: If exists, open it
STEP 7: If Does not exist, Check if G:/MyGame.exe exits
STEP 8: If exists, open it
STEP 9: If Does not exist, Check if H:/MyGame.exe exits
STEP 10: If exists, open it
STEP 11: If Does not exist, exit



See More: Batch: To generate a working shortcut...

Report •


#1
September 4, 2011 at 10:10:58
Can anyone help me out please? I am virtually illiterate in Programming...

Report •

#2
September 4, 2011 at 12:04:11
✔ Best Answer
Try this;

@echo off
if exist D:\MyGame.exe set found=D:
if exist E:\MyGame.exe set found=E:
if exist F:\MyGame.exe set found=F:
if exist G:\MyGame.exe set found=G:
if exist H:\MyGame.exe set found=H:
echo.
echo MyGame.exe on %found%
echo.
echo Press any key to start MyGame.exe..
pause>nul
start %found%\Mygame.exe
exit

Regards,

MUs

Happy is ONE who says I am an OttoMAN.


Report •

#3
September 4, 2011 at 21:58:50
Thanks very much sir, it really did work..
Excellent work...

Report •

Related Solutions

#4
September 5, 2011 at 01:34:05
You're welcome,

Happy is ONE who says I am an OttoMAN.


Report •


Ask Question