Problem with a script that should remove and add shortcuts


  1. Posts : 17
    Windows 2008 R2, Windows 7 Enterprise, Ubuntu 11.10
       #1

    Problem with a script that should remove and add shortcuts


    Hi.

    Im going to install windows 7 on 20+ machines. So I have taken an old auto-install script I had for windows XP and trying to make it work for windows 7.

    WHat I want it to do is to remove the shortcut "spark.exe.ink" for all users from the desktop and I want "spark.exe.ink" to be added to the "autostart" for all users

    So here is the string from the old script:

    echo.
    echo Städa Spark...
    xcopy "%ALLUSERSPROFILE%\desktop\Spark.exe.lnk" "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup\spark.exe.lnk" /I /E /H /Q

    del "%ALLUSERSPROFILE%\desktop\Spark.exe.lnk"


    How do I make it work in windows 7?
    Is the enviorment variable %allusersprofile% not working in windows 7?

    Thanks for any help

    Regards
    Greatness
    Last edited by Greatness; 02 May 2012 at 06:53.
      My Computer


  2. Posts : 6,285
    Windows 10 Pro X64
       #2

    What happens when you try to run it?

    %ALLUSERSPROFILE% is valid in Win 7, points to C:\Programdata

    %ALLUSERSPROFILE%\desktop\Spark.exe.lnk" "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup is also valid, so it the copy and delete should work.
      My Computer


  3. Posts : 17
    Windows 2008 R2, Windows 7 Enterprise, Ubuntu 11.10
    Thread Starter
       #3

    Ztruker said:
    What happens when you try to run it?

    %ALLUSERSPROFILE% is valid in Win 7, points to C:\Programdata

    %ALLUSERSPROFILE%\desktop\Spark.exe.lnk" "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup is also valid, so it the copy and delete should work.
    When I run it it says "spark.exe.lnk cant be found" on all three operations.
    But %ALLUSERSPROFILE%\desktop\Spark.exe.lnk -> c:\programdata\desktop\spark.exe.lnk .. But there is no user data in "programdata" is there?
    I might be completly wrong.
    But when I run it, it dosent find the file, so it cant copy it or remove it.

    Regards
    Greatness
      My Computer


  4. Posts : 6,285
    Windows 10 Pro X64
       #4

    There is no desktop folder under %ALLUSERSPROFILE% (C:\Programdata).

    Maybe what you are looking for is: C:\Users\Default\Desktop ????

    Maybe that's where the spark.exe.lnk file is located?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:34.
Find Us