Ignoring Error Messages When Using *.vbs Scripts

G

Guest

I am very new at this scripting thing and would like to ignore error messages
when running a script. Particularly the one located at the URL below:

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Whenever I run it to delete files in my %temp% folder and there are files in
use (set to read-only) I get an error message stating that files are not
accessible. I want to ignore this message. I know that there are times when
temp files are in use and I don't want to delete them if they are but I do
want to delete files in the directory that are not in use and not the ones
that are while at the same time avoiding this error message. Any help would
be greatly appreciated. I'm still learning so please bare with me. Also,
I'd like to know how similar these VB scripts are to VBA (like with Access
VBA, etc.)
 
S

Shenan Stanley

Donald said:
I am very new at this scripting thing and would like to ignore
error messages when running a script. Particularly the one located
at the URL below:

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Whenever I run it to delete files in my %temp% folder and there are
files in use (set to read-only) I get an error message stating that
files are not accessible. I want to ignore this message. I know
that there are times when temp files are in use and I don't want to
delete them if they are but I do want to delete files in the
directory that are not in use and not the ones that are while at
the same time avoiding this error message. Any help would be
greatly appreciated. I'm still learning so please bare with me.
Also, I'd like to know how similar these VB scripts are to VBA
(like with Access VBA, etc.)

Beginning of your VBSCRIPT:

on error resume next
 
G

Guest

Just to verify; this will still delete all files not in use? My other
question was to what extent is this VBS script similar to that of VBA code as
with Access etc.?
 
A

Ayush

[Donald Fisher] wrote-:
I am very new at this scripting thing and would like to ignore error messages
when running a script. Particularly the one located at the URL below:

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Whenever I run it to delete files in my %temp% folder and there are files in
use (set to read-only) I get an error message stating that files are not
accessible. I want to ignore this message. I know that there are times when
temp files are in use and I don't want to delete them if they are but I do
want to delete files in the directory that are not in use and not the ones
that are while at the same time avoiding this error message. Any help would
be greatly appreciated.

You can use the DEL command :
del "%temp%\*" /f /q /a

I'm still learning so please bare with me. Also,
I'd like to know how similar these VB scripts are to VBA (like with Access
VBA, etc.)


Ask in VBS NG: microsoft.public.scripting.vbscript

Good Luck, Ayush.
 

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