Solved

Batch file to ping the network

Posted on 2004-09-24
7
310 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sorting in Excel with Group Headers if the Exist 2 92
mapAB Challlenge 35 146
allswap challenge 6 99
Adoquery sql  left join does not work 25 91
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.

831 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