Results 1 to 4 of 4

Thread: Create Shortcuts on a USB Drive

  1. #1
    Join Date
    Jan 2009
    Posts
    35

    Create Shortcuts on a USB Drive

    Hi,
    I can create a shortcut and put it on the root of the drive, and it works until i plug my OCZ Diesel 16gb USB 2.0 Flash Drive in to computer that assign letter which is different from first one and shortcut will break down and not work. Hence the need for a shortcut with a relative path.

  2. #2
    Join Date
    Jan 2008
    Posts
    644

    Re: Create Shortcuts on a USB Drive

    • Create a new text document (to create a text document right click anywhere on your desktop, select new, then select “Text Document” from the context menu). Open it and type in the path for the executable, between quotes, without the drive letter and colon (e.g. “\EjectUSB\EjectUSB.exe” - with the quotes). Save and exit. It does not matter what you name the file at this point, but let’s say you named it shortcut.txt for reference.
    • Rename the text file and change the extension to .BAT instead of .TXT.
    • Before we go further we have to extract the icon from the original app and save it as an ICO file. To do this use a program such as “BecyIconGrabber“. Download, extract, and run, then point to the original executable (”F:\EjectUSB\EjectUSB.exe” in this case). Right click on the icon when it appears (it doesn’t matter which size icon you are looking at) and save it as an ICO file.
    • Download and unzip the free “Bat To Exe Converter” and run it. In the program dialog, point to the batch file you created (shortcut.bat) for the”batchfile” field and to the extracted ICO file for the “Iconfile” field. Use the “Compile” button to complete the operation.
    • Two more things left to do (1) rename the new executable if you want to, and (2) move it to the root folder of your USB device.
    • That’s it. You can now run the new exe file from the USB’s root folder to launch your program; it will always preserve the relative path, no matter what letter Windows assigns the USB device.

  3. #3
    Join Date
    Jun 2006
    Posts
    623

    Re: Create Shortcuts on a USB Drive

    hi,
    You can use environment variables in shortcuts just like in batch files.
    eg:
    %ProgramFiles%\Internet Explorer\IEXPLORE.EXE
    %WINDIR%\NOTEPAD.EXE
    %systemdrive%\boot.ini
    %userprofile%\Desktop\SomeFile.exe

  4. #4
    Join Date
    Dec 2007
    Posts
    1,599

    Re: Create Shortcuts on a USB Drive

    Why not just access the registry directly and copy/create the shortcut there using %systemroot% in the program path.
    I'm guessing you want %systemroot%\Documents and Settings\All Users\Desktop

    If you need to use a .bat to add the reg file, you should be able to use the /Q switch or a quiet/force directive to prevent user prompts if that's what you're after.

Similar Threads

  1. Firefox will not create valid Desktop Shortcuts
    By AJAMU in forum Technology & Internet
    Replies: 4
    Last Post: 02-02-2011, 07:08 AM
  2. Create Keyboard shortcuts in Dreamweaver
    By Elieis in forum Software Development
    Replies: 3
    Last Post: 03-01-2010, 01:54 AM
  3. Create shortcuts in the command line
    By DarenHawk in forum Software Development
    Replies: 4
    Last Post: 27-04-2009, 11:11 PM
  4. How to Create Shortcuts in Windows Mobile
    By Steinbach in forum Portable Devices
    Replies: 4
    Last Post: 15-04-2009, 03:05 PM
  5. Replies: 2
    Last Post: 28-10-2008, 04:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,695,448.36904 seconds with 17 queries