Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I delete a .url file from users/desktop profiles using the .bat file that I've created?

Posted on 2009-02-18
6
Medium Priority
?
1,092 Views
Last Modified: 2012-05-06
I need to replace .url icons on remote computers with a new icon.  Some of the icons are placed in user/desktop profiles and not placed in the all users/desktop profile.  The script below will delete the .url from the all user's folder, but how do I delete the .url from a user's profile if the .url isn't in the all user's profile?  There are too many users to add all of the profile names to the .bat file.

Is there something that I can replace "All Users" with so that every profile on that computer is included?
run as.bat
runas /user:xxxxx\administrator \\servername\xxxx\scripts\add_new_viawarp.bat
 
add_new_viawarp.bat
del "C:\Documents and Settings\All Users\Desktop\ViaWarp.url"
copy "\\servername\xxxxx\Via_Warp.url" "C:\Documents and Settings\All Users\Desktop\"
pause

Open in new window

0
Comment
Question by:catalysttg
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:rionroc
ID: 23675426
Hello

try this:
copy /Y \\servername\xxxxx\Via_Warp.url  C:\Documents and Settings\All Users\Desktop\Via_Warp.url

No need to command del, by copy /Y, file will be overwritten without prompt.



Great is our GOD.
:)
rionroc
0
 
LVL 21

Expert Comment

by:AmazingTech
ID: 23675544
How is this script going to run? Who's going to type in the password for the runas?

Would the user have created the shortcut with the same name?

0
 

Author Comment

by:catalysttg
ID: 23681023
Thanks rionroc,
but you may notice that the file that is being replaced has a slightly different name, therefore I don't believe that will work.

Amazing Tech,
I will be using VNC to log into every computer to run the password.  I'm not comfortable placing the password in the .bat for the end user to use.  And yes, the user would have the shorcut as the same name on every computer.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:AmazingTech
ID: 23682181
Can you not remotely access your computers through the administrative share?

DIR \\{Remotecomputer}\c$
0
 
LVL 21

Accepted Solution

by:
AmazingTech earned 2000 total points
ID: 23682309
Save the code snippet as VIAWarpUpdate.cmd

You can run it and type in the computer you want to update or from a command line.

VIAWarpUpdate {remotecomputer}

Or have a list of remote computers in a file say computers.txt and create this 2nd batch file that takes each computer from computers.txt (1 name per line) and call VIAWarpUpdate.cmd.

for /f %%a in (computers.txt) do call VIAWarpUpdate %%a
CLS
@echo off
set comp=%1
if not defined comp set /p comp=Enter the computer name you wish to Upgrade VIA Warp shortcuts on: 
 
IF not defined comp goto FINISH
    PING -n 1 -w 100 %comp%
    IF ERRORLEVEL 1 GOTO NOTON
 
    REM Delete any existing VIAWarp.url
    for /r "\\%Comp%\c$\Documents and settings" %%a in (VIAWarp.url) do DEL /q "%%a"
 
    REM Add VIA_Warp.url to the All Users Profile.
    copy "\\servername\xxxxx\Via_Warp.url" "\\%comp%\C$\Documents and Settings\All Users\Desktop\"
pause
 
 
:NOTON
ECHO %comp% is not on.
GOTO FINISH
 
:FINISH

Open in new window

0
 

Author Closing Comment

by:catalysttg
ID: 31548477
Thanks so much AmazingTech.  Everything seems to work well.  I haven't ran into any computer that were turned off or had a firewall on yet, but i don't think that's your problem.  Again, I apreciate the help
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question