Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old August 4th, 2009, 09:58 AM
italiana97 italiana97 is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 1 italiana97 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 43 sec
Reputation Power: 0
DOS Batch - Simple Batch File Assistance....PLEASE!

Good morning.
I believe I have a fairly simple request, but with absolutely no knowledge of scripting, I am at a loss.

What I need is a batch file that will check a number of systems on my network that are listed in a text document (machines.txt) and determine whether or not a file exists. If that file does not exist, I simply want the computer name to output to a text file (missing.txt).

Seems simple enough, but I cannot put this code together at all.
Any assistance is GREATLY appreciated.
Thanks!
D

Reply With Quote
  Trader Rating: 0 · #2  
Old August 4th, 2009, 07:25 PM
JohnFrank's Avatar
JohnFrank JohnFrank is offline
Contributing User
Click here for more information
Click here for more information
 
Join Date: Jan 2008
Location: Lilyfield NSW Australia
Posts: 1,561 JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)JohnFrank User rank is General 116th Grade (Above 100000 Reputation Level)  Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44Folding Points: 21974789 Folding Title: Super Ultimate Folder - Level 44
Time spent in forums: 2 Weeks 6 Days 22 h 52 m 47 sec
Reputation Power: 8694
Send a message via MSN to JohnFrank
Quote:
Originally Posted by italiana97
Good morning.
I believe I have a fairly simple request, but with absolutely no knowledge of scripting, I am at a loss.

What I need is a batch file that will check a number of systems on my network that are listed in a text document (machines.txt) and determine whether or not a file exists. If that file does not exist, I simply want the computer name to output to a text file (missing.txt).

Seems simple enough, but I cannot put this code together at all.
Any assistance is GREATLY appreciated.
Thanks!
D
What you are trying to do is not going to be a 'simple' DOS batch file.

You need to run commands angainst enach entry in your source file and have different outputs depending on the results of thos programs. This will require a script at least.
__________________

Reply With Quote
  Trader Rating: 0 · #3  
Old August 20th, 2009, 10:37 AM
JenniC JenniC is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 4 JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level)JenniC User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 h 8 m 40 sec
Reputation Power: 0
Checking machines on the network with biterscripting

Perhaps, the following script may help. I am going to assume, that machines.txt file is at C:\machines.txt and has one system name per line. Also, that the file you want to check on each system is at C:\file on that system.


Code:
# Script machines.txt
# Get the list of machines.
var str list ; cat "C:\machines.txt" > $list
# Check machines one by one.
var str machine ; lex "1" $list > $machine
while ($machine <> "")
do
    # Check the file C:\file on $machine. It is at $machine://C:\file.
    af ($machine+"://C:\file") > null
    # If the file exists, system variable $fexists is set to true ( bool).
    if ( NOT ($fexists) )
        # File does not exist. Print machine name.
        echo $machine
    endif
    # Get the next machine.
    lex "1" $list > $machine
done



Script is in biterscripting ( http://www.biterscripting.com ) . To use, save the script as C:\Scripts\machines.txt, start biterscripting, enter the following command.

Code:
script machines.txt



To redirect the list of missing machines to missing.txt, use the following.

Code:
script machines.txt > missing.txt



This can also be done in powershell.

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > DOS Batch - Simple Batch File Assistance....PLEASE!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
     
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek