Jump to content

Recommended Posts

Posted

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 in

C:\Documents and Settings\Administrator\Start Menu

and ideally I want it to place its shortcuts in

C:\Documents and Settings\All Users\Start Menu

The 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


Posted

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.

Posted

Thanx Yzöwl, I just realised that I can leave the shortcut in

$OEM$\$Docs\All Users\Start Menu\Programs\Speedfan

and 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.

Posted

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 off
for /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 :eof

It may be a good idea to stick it in your cleanup.cmd after all your installs have finished

Posted

working with the above code, can someone modify it to move ALL shortcuts from [all individual users]\desktop to %AllUsersProfile%\Desktop

in addition to moving all the shortcuts from individual users start menu to AllUsersProfile's start menu?

Posted

Try

@echo off
for /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 :eof

as 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.....

Posted

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 robocopy

Moving directory trees from a profile could prove dangerous

Also, 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 off
for /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

Posted

replaced some language-specific words to make it work for Dutch XP, i can't write advanced batch thingy's myself.

@echo off
for /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 :eof

cheers

Posted

Thanx Yzöwl

I'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.

Posted

Here is the basic idea using robocopy, so that we are moving instead of copying:

@echo off
for /d %%a in ("%UserProfile%\..\*") do if "%%~na" neq "All Users" call :doit "%%~a"
goto :eof
:doit
pushd %1
del /q Desktop\*.lnk>nul
%~dp0robocopy "Start Menu" "%AllUsersProfile%" /E/Z/MOVE/R:5/W:2/XF ?esktop.ini>nul
popd
goto :eof

This 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

Posted

You could create shortcuts with vbScript like this:

'Create Windows Explorer Desktop icon

Set 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 = 1

link.WorkingDirectory = "%HOMEDRIVE%%HOMEPATH%"

link.Save

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...