Solved

Batch file to ping the network

Posted on 2004-09-24
7
308 Views
Last Modified: 2010-04-17
Can any one help me to make a batch file to ping the network and also to clear the documents in MY Documenst.
Please be as easy as possible
0
Comment
Question by:yavooza
  • 4
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
Sargon666777 earned 350 total points
ID: 12142277
Well here is a generic set of commands.  You of course will have to substitute the variables for your information...
Also since you didnt say what OS I am going to assume it is Windows 2000 +

@ECHO OFF
PING (insert ip here)
del C:\documents and settings\(profile name)\my documents\*.*
0
 
LVL 2

Author Comment

by:yavooza
ID: 12142357
The last line is not working
The docuaments are not getting cleard
0
 
LVL 1

Expert Comment

by:Sargon666777
ID: 12142395
It sounds like you meant to clear recent documents... not my documents if that is the case change the last line to
del C:\documents and settings\(profile name)\recent\*.*
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:Sargon666777
ID: 12142432
one last note... if you dont want del to prompt you change to
del /q C:\documents and settings\(profile name)\recent\*.*
0
 
LVL 2

Author Comment

by:yavooza
ID: 12142462
I meant about the documenst in the recent folder . How to delete them with the batch file.
0
 
LVL 1

Expert Comment

by:Sargon666777
ID: 12142511
yeah the command I just gave you will do so... so your total batch file would be

@ECHO OFF
PING (insert ip here)
del /q C:\documents and settings\(profile name)\recent\*.*

you can obmit the /q if you wish, and dont forget to replace the ip, and put your profile name in place of (profile name).  
0
 

Assisted Solution

by:waitandsee123
waitandsee123 earned 150 total points
ID: 12150474
Sargon666777's first two lines of the batch file are correct, I'd like to add the following on the delete portion of the answer, assuming Windows 2000+ as well.

To delete the items recent folder for the "current user" do:

del "c:\documents and settings\%username%\recent\*.*"

%username% will be recognized by a batch file and will substitute the actual username in its place.  

Also, any time you have a path or filenames with spaces in them, each one should have "double quotes" around the entries with spaces or you'll get an error.  I've included quotes around the whole thing, just in case you have spaces in the username as well.

---------------

To delete the items in the recent folder for a "specific user" substitute the actual username.

del "c:\documents and settings\username\recent\*.*"

---------------

To delete the items in the recent folder for "ALL users" on the computer you can do the following, but it gets a little more complicated, but still can be done in one line of code:

This will show you what will happen but won't do anything (NOTE: Must be executed within a batch file, if you do from command line, change all instances of %%i to just %i).

Demonstrates what will happen only, no deletions performed, the following command should appear all on one line:

FOR /F "tokens=1* delims=" %%i in ('dir "c:\documents and settings" /b') do @echo del c:\documents and settings\%%i\recent\*.*"


This command will do the work, and should appear all on one line as well:

FOR /F "tokens=1* delims=" %%i in ('dir "c:\documents and settings" /b') do @del c:\documents and settings\%%i\recent\*.*"

Hope this helps.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

16 Experts available now in Live!

Get 1:1 Help Now