Solved

Batch file to ping the network

Posted on 2004-09-24
7
311 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

820 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