Halfwalker Posted October 14, 2005 Posted October 14, 2005 Tough to put the whole question into the topic line up there. Basically, I'm trying to figure out how to create shortcuts, dirs etc, that will be created whenever a new user is created. The dirs etc are easy - make them as you like in c:\documents and settings\Default User\ and the first time the user logs in, those will all be copied over.The problem is with shortcuts that need the Starts In field set to their My Documents folder. The username isn't known at install time, so there must be a way to run a batchfile when the user is created. That would know the username, and thus be able to create the shortcuts appropriately.The example I'm using is the Putty SSH tools, Puttygen.exe. It defaults to offering to save keyfiles in the folder it was started from. You have to navigate back up to your My Documents folder or somewhere. I want it to default to My Documents\SSH Tools. So manually, I set the Starts In[/b field in the shortcut to c:\Documents and Settings\username\My DocumentsAs an example, my Tweaks.cmd file runs after RunOnceEx.cmd, and does this :echo Install Putty SSH programsmd "%systemdrive%\Program Files\SSH Tools"md "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\SSH Tools"md "%systemdrive%\Documents and Settings\Administrator\My Documents\SSH Tools"md "%systemdrive%\Documents and Settings\Default User\My Documents\SSH Tools"copy "%PP%\Putty\putty.exe" "%systemdrive%\Program Files\SSH Tools"copy "%PP%\Putty\puttygen.exe" "%systemdrive%\Program Files\SSH Tools"copy "%PP%\Putty\pscp.exe" "%systemdrive%\Program Files\SSH Tools"copy "%PP%\Putty\psftp.exe" "%systemdrive%\Program Files\SSH Tools"copy "%PP%\Putty\pageant.exe" "%systemdrive%\Program Files\SSH Tools"xxmklink "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\SSH Tools\Puttygen.lnk" "%systemdrive%\Program Files\SSH Tools\puttygen.exe" "" "%systemdrive%\Documents and Settings\Administrator\My Documents\SSH Tools"xxmklink "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\SSH Tools\Putty.lnk" "%systemdrive%\Program Files\SSH Tools\putty.exe" "" "%systemdrive%\Documents and Settings\Administrator\My Documents\SSH Tools"xxmklink "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\SSH Tools\PSFTP.lnk" "%systemdrive%\Program Files\SSH Tools\psftp.exe" "" "%systemdrive%\Documents and Settings\Administrator\My Documents\SSH Tools"rem Pageant link needs a parameter of the keyfile to usexxmklink "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\SSH Tools\Pageant Key agent.lnk" "%systemdrive%\Program Files\SSH Tools\pageant.exe" "" "%systemdrive%\Documents and Settings\Administrator\My Documents\SSH Tools"I need to be able to duplicate the xxmklink lines when a new user is created, replacing Administrator with the new username.Any ideas ?D.
InTheWayBoy Posted October 14, 2005 Posted October 14, 2005 Would the %USERPROFILE% variable help?That would allow you to write your scripts and just use something like this:%USERPROFILE%\Start Menu\Blah\Blah.lnkOr:%USERPROFILE%\My DocumentsThat should work, but if it doesn't someone else will probably have an answer...good luck!
Halfwalker Posted October 16, 2005 Author Posted October 16, 2005 Would the %USERPROFILE% variable help?That would allow you to write your scripts and just use something like this:%USERPROFILE%\Start Menu\Blah\Blah.lnkOr:%USERPROFILE%\My DocumentsThat should work, but if it doesn't someone else will probably have an answer...good luck!Bingo - that works. It only works for the Starts In field though - can't use it in the Target field.Thanks -D.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now