rikgale Posted May 17, 2005 Posted May 17, 2005 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
Yzöwl Posted May 17, 2005 Posted May 17, 2005 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.
rikgale Posted May 17, 2005 Author Posted May 17, 2005 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.
Yzöwl Posted May 17, 2005 Posted May 17, 2005 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
rikgale Posted May 17, 2005 Author Posted May 17, 2005 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.
rikgale Posted May 17, 2005 Author Posted May 17, 2005 Is there a guide or something that teaches you how to write code like the example above?
durex Posted May 20, 2005 Posted May 20, 2005 Its called 'batch'. Pretty simple stuff once you get the hang of it.http://www.google.com/search?q=batch+files...:en-US:official
a06lp Posted May 20, 2005 Posted May 20, 2005 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?
rikgale Posted May 20, 2005 Author Posted May 20, 2005 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.....
Yzöwl Posted May 20, 2005 Posted May 20, 2005 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
eben Posted May 21, 2005 Posted May 21, 2005 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
Yzöwl Posted May 21, 2005 Posted May 21, 2005 Also whilst I'm here I'll just tidy rikgales attempt for his benefit onlyJust a reminder!
rikgale Posted May 21, 2005 Author Posted May 21, 2005 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.
Yzöwl Posted May 25, 2005 Posted May 25, 2005 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
tguy Posted May 25, 2005 Posted May 25, 2005 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
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