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

Posted on 2009-02-18
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


del "C:\Documents and Settings\All Users\Desktop\ViaWarp.url"

copy "\\servername\xxxxx\Via_Warp.url" "C:\Documents and Settings\All Users\Desktop\"


Open in new window

Question by:catalysttg
    LVL 12

    Expert Comment


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

    Expert Comment

    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?


    Author Comment

    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.

    LVL 21

    Expert Comment

    Can you not remotely access your computers through the administrative share?

    DIR \\{Remotecomputer}\c$
    LVL 21

    Accepted Solution

    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
    @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%
        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\"
    ECHO %comp% is not on.

    Open in new window


    Author Closing Comment

    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

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
    The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now