Solved

Batch file to ping the network

Posted on 2004-09-24
7
307 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
Comment Utility
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
Comment Utility
The last line is not working
The docuaments are not getting cleard
0
 
LVL 1

Expert Comment

by:Sargon666777
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

by:Sargon666777
Comment Utility
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
Comment Utility
I meant about the documenst in the recent folder . How to delete them with the batch file.
0
 
LVL 1

Expert Comment

by:Sargon666777
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 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

12 Experts available now in Live!

Get 1:1 Help Now