Jump to content

Unattended shortcut to optical drive


Recommended Posts

I know that you can simply insert a shortcut to the systemdrive using the $DOCS\ALL USERS\Desktop\ folder setup, but the shortcut does not accept %CDROM% as a variable drive path. My installs can have various optical drive letters, so I dont want to make the shortcut simply a drive letter. Is there another variable, or another way to accomplish this?

Link to comment
Share on other sites


No variables for this as there can be quite a few removable drives in any system.

You can however create your own variable in the windows setup scripts, i.e. in a .cmd that is run from cmdlines.txt, add:

reg.exe add HKCU\Environment /v CDROM /d %~d0\ /f

This gives you a CDROM variable containing the drive letter of the location of the script, your windows cd - but it won't reflect system changes after setup, so use is very limited.

You may use %~d0\ in other steps of your installation, as long as its in a .cmd file. (%~dp0 gives you the complete dir of your script)

Flo

Link to comment
Share on other sites

I've created this packaged script as an executable file which may help you out!

Just run it, it doesn't require parameters so it should work equally well unattendedly as on a live system.

Run as administator may be necessary in Windows Vista etc.

CDdList.zip

Link to comment
Share on other sites

Before creating the link, read the value in HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\SourcePath and use it to create your link. This works only if you install windows from CD, installing custom applications from network share doesn't affect this.

Edited by an3k
Link to comment
Share on other sites

Just a small update to my previous post.

The file will programmatically retrieve the current optical drive(s) and create shortcut(s) on the 'All Users' Desktop to all found.

The Shortcut(s) will obviously carry the drive letter as their distinguishing feature:

Optical Drive [X]

Where X is the assigned drive letter

In order to prevent the possibility of failure before a certain stage of the unattended setup procedure, I have deliberately not used WMI as I've heard reports that it isn't always available during the installation timeline.

The executable works on both XP and Vista x86 but has not been tested on x64 systems.

To prevent a shortcut installation failure the exe will need to be Run as administrator on a live Vista machine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...