Batch file to delete existing shortcuts

  • Thread starter Thread starter ano1optimist
  • Start date Start date
A

ano1optimist

I'm trying to code a batch file that will delete any existing icons
with a filename of *text*.lnk that reside on the local C drive. I can
run the commands at a command prompt but when I execute them in a batch

program, I get unexpected results. How can I accomplish this task?
 
ano1optimist said:
I'm trying to code a batch file that will delete any existing icons
with a filename of *text*.lnk that reside on the local C drive. I can
run the commands at a command prompt but when I execute them in a batch
program, I get unexpected results. How can I accomplish this task?

The resident mind reader is on vacation. You need to tell us what
commands you're using at the command prompt and precisely what happens
when you try to use them in the batch file.
 
Gary Smith said:
The resident mind reader is on vacation. You need to tell us what
commands you're using at the command prompt and precisely what happens
when you try to use them in the batch file.

And please don't multi-post.
 
I'm trying to code a batch file that will delete any existing icons
with a filename of *text*.lnk that reside on the local C drive. I can
run the commands at a command prompt but when I execute them in a batch

program, I get unexpected results. How can I accomplish this task?

for /f "Tokens=*" %%a in ('dir c:\*test*.lnk /b /s /a') do del /q /f "%%a"

AND DON'T MULTI-POST!

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
Back
Top