Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Batch file to ping the network

Posted on 2004-09-24
7
Medium Priority
?
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
Sargon666777 earned 1400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 600 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

604 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