Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Problem with a script that should remove and add shortcuts

02 May 2012   #1
Greatness

Windows 2008 R2, Windows 7 Enterprise, Ubuntu 11.10
 
 
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


My System SpecsSystem Spec
.
02 May 2012   #2
Ztruker

Windows 10 Pro X64
 
 

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 System SpecsSystem Spec
03 May 2012   #3
Greatness

Windows 2008 R2, Windows 7 Enterprise, Ubuntu 11.10
 
 

Quote   Quote: Originally Posted by Ztruker View Post
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 System SpecsSystem Spec
.

03 May 2012   #4
Ztruker

Windows 10 Pro X64
 
 

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 System SpecsSystem Spec
Reply

 Problem with a script that should remove and add shortcuts




Thread Tools




Similar help and support threads
Thread Forum
script file in start up I would like to remove
In order to VPN into my office from my personal laptop (while they set up one for me). A script file was installed in my laptop to path all the drives on the server. I no longer need this and would like to correctly remove it from my computer. The IT guys says, just remove the script from the start...
General Discussion
Creating a batch script or use a 3rdpartyprogram to create shortcuts
Hello! I'm having trouble creating a batch script to simply copy a shortcut to the desktop from a program installation, then carry out some tasks. Overall my goals are: Burn a CD that includes a autorun.inf that will load a batch script In the script I want it to activate two self...
General Discussion
Batch script to change how applications open from shortcuts
Hi. I have Googled this without success. Does anyone know of a script (or is able to write one?) which will batch convert a folder (+ subfolders) full of shortcuts so that they all open the application they link to (in the case, Microsoft Flight Simulator) in a maximized, not 'normal' window? ...
General Discussion
how to remove a malicious script
I have a malicious script file that prevents Adobe flash from opening Youtube or browser sites that need flash to view. This is the script file: Script: file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/components/nsPlacesDBFlush.js:235 I have uninstalled IE 8 and IE9 tried Firefox....
Browsers & Mail
How to Remove Stubborn Start Menu Shortcuts
This morning I noticed that my Start Menu | All Programs list had some shortcuts that were duplicates. In other words, there were two "Free Games" shortcuts and two "1000 Free Songs" shortcuts. Clearly these were added by some program(s) that I had installed earlier. I right-clicked and deleted...
General Discussion
HOW to remove UAC protection shield from shortcuts
is it possible to remove the UAC protection shield from shortcuts ?? :confused:
Customization


Our Sites

Site Links

About Us

Find 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 02:27.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App