May 17, 200521 yr Is it possible to specify where a program places its shortcuts when it installs itself. For example, at the moment when I install speedfan 4.22 as a silent install it places shortcuts for itself inC:\Documents and Settings\Administrator\Start Menuand ideally I want it to place its shortcuts inC:\Documents and Settings\All Users\Start MenuThe reason for this is that I use a different Administrator name on each computer and I don't really want to have to change the Administrator name in too many places before burning a CD or testing.Ta Rik
May 17, 200521 yr Unfortunately some programs think that they aren't for 'all users', that is down to the programmer.My initial solution would be, in a batch file copy all the shortcuts to the 'All Users' Start Menu.
May 17, 200521 yr Author Thanx Yzöwl, I just realised that I can leave the shortcut in$OEM$\$Docs\All Users\Start Menu\Programs\Speedfanand I can ignore what it does in the admin account. Just so long as the program is installed the same place then a shortcut from an active system can be used. If the shortcut is already in All Users\Start Menu then the batch file that I use will work fine.
May 17, 200521 yr here is an example batch that should copy everything pertinent from 'all non-hidden users'\Start Menu\Programs to the All Users\Start Menu\Programs@echo offfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do ( if "%%~na" neq "All Users" ( if exist "%%~a\Start Menu\Programs" ( xcopy /s/c/i/q/y "%%~a\Start Menu\Programs\*" "%AllUsersProfile%\Start Menu\Programs">nul ) ))goto :eofIt may be a good idea to stick it in your cleanup.cmd after all your installs have finished
May 17, 200521 yr Author thanx, I'll give it a shot next time I do a build and try and remember to post back as to how it went.
May 17, 200521 yr Author Is there a guide or something that teaches you how to write code like the example above?
May 20, 200521 yr Its called 'batch'. Pretty simple stuff once you get the hang of it.http://www.google.com/search?q=batch+files...:en-US:official
May 20, 200521 yr working with the above code, can someone modify it to move ALL shortcuts from [all individual users]\desktop to %AllUsersProfile%\Desktopin addition to moving all the shortcuts from individual users start menu to AllUsersProfile's start menu?
May 20, 200521 yr Author Try@echo offfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do ( if "%%a" neq "All Users" ( if exist "%%~a\Start Menu\Programs" ( xcopy /s/c/i/q/y "%%~a\Start Menu\Programs\*" "%AllUsersProfile%\Start Menu\Programs">nul ) ))for /d %%a in ("%AllUsersProfile:\All Users=%\*") do ( if "%%a" neq "All Users" ( if exist "%%~a\Desktop" ( xcopy /s/c/i/q/y "%%~a\Desktop\*" "%AllUsersProfile%\Desktop">nul ) ))goto :eofas far as I can guess all U have to do is copy the code and change Start Menu\Programs to Desktop. Can you try the above code and see if it works. I would test it myself but I don't keep any shortcuts on the desktop apart from the standard one, so there'd be no point in copying them over themseleves.Let us know how you get on.....
May 20, 200521 yr Just remember that the code I created only copies, it doesn't move!If you are moving, as opposed to copying, I would suggest using robocopyMoving directory trees from a profile could prove dangerousAlso, some programs, I'm assuming you mean 'Start Menu' + subdirectories, may also use extensions other than .lnk, .url being a common one.Also whilst I'm here I'll just tidy rikgales attempt for his benefit only@echo offfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do ( if "%%~na" neq "All Users" ( if exist "%%~a\Start Menu\Programs" ( xcopy /s/c/i/q/y "%%~a\Start Menu\Programs\*" "%AllUsersProfile%\Start Menu\Programs">nul ) if exist "%%~a\Desktop\*.lnk" ( move "%%~a\Desktop\*.lnk" "%AllUsersProfile%\Desktop" ) ))goto :eof
May 21, 200521 yr replaced some language-specific words to make it work for Dutch XP, i can't write advanced batch thingy's myself.@echo offfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do ( if "%%a" neq "All Users" ( if exist "%%~a\Menu Start\Programma's" ( xcopy /s/c/i/q/y "%%~a\Menu Start\Programma's\*" "%AllUsersProfile%\Menu Start\Programma's">nul ) if exist "%%~a\Bureaublad\*.lnk" ( move "%%~a\Bureaublad\*.lnk" "%AllUsersProfile%\Bureaublad" ) ))goto :eofcheers
May 21, 200521 yr Also whilst I'm here I'll just tidy rikgales attempt for his benefit onlyJust a reminder!
May 21, 200521 yr Author Thanx YzöwlI'm still working on learning batch code. Programming and coding have never been my strong points as I am sure that you can tell! It just seemed logical to copy the code and change the file path.
May 25, 200521 yr Here is the basic idea using robocopy, so that we are moving instead of copying:@echo offfor /d %%a in ("%UserProfile%\..\*") do if "%%~na" neq "All Users" call :doit "%%~a"goto :eof:doitpushd %1del /q Desktop\*.lnk>nul%~dp0robocopy "Start Menu" "%AllUsersProfile%" /E/Z/MOVE/R:5/W:2/XF ?esktop.ini>nulpopdgoto :eofThis has not been tested, so no blame please!You would need to have robocopy.exe in the same location as the batch file. If robocopy is already in your %PATH%, then you just need t0 remove the %~dp0
May 25, 200521 yr You could create shortcuts with vbScript like this:'Create Windows Explorer Desktop iconSet Shell = CreateObject("WScript.Shell")DesktopPath = Shell.SpecialFolders("AllUsersDesktop")Set link = Shell.CreateShortcut(DesktopPath & "\Explorer.lnk")link.Arguments = "/n,/e,c:\"link.Description = "Explorer link"link.HotKey = "CTRL+ALT+SHIFT+E"link.IconLocation = "%SystemRoot%\explorer.exe"link.TargetPath = "%SystemRoot%\explorer.exe"link.WindowStyle = 1link.WorkingDirectory = "%HOMEDRIVE%%HOMEPATH%"link.Save
Create an account or sign in to comment