We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

Medium Priority
1,119 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

Comment
Watch Question

Commented:
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
Top Expert 2009

Commented:
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

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

Top Expert 2009

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

DIR \\{Remotecomputer}\c$
Top Expert 2009
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.