Batch file to delete existing shortcuts

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?
 
G

Gary Smith

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.
 
T

Todd Vargo

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.
 
J

Jerold Schulman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top