Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


April 2000

Resource Kit Batch File Commands


RSS
Subscribe to Windows IT Pro | See More Resource Kit Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

In this installment of Top 10, I share my favorite Microsoft Windows NT Server 4.0 Resource Kit commands, which I frequently use with my NT command shell scripts. Choosing only 10 commands is difficult because the resource kit provides a rich selection of utilities. (Check out Mark Minasi's This Old Resource Kit columns for more information about resource kit tools.)

10. AutoExNT lets you start the NT command autoexnt.bat when your system boots up, without requiring the user to log on to the system. You use the Instexnt install command to install AutoExNT. To make the service start automatically, go to the Control Panel Services applet and set AutoExNT's startup option to Automatic.

9. AddUsers lets you add and delete user accounts. The command, which you can use for local and remote accounts, reads the account names from a comma-delimited file. Here's how to use AddUsers to add accounts from the accounts.txt file to the system named MyServer:

addusers //MyServer /c accounts.txt

8. IfMember, a useful addition to your logon scripts, lets your scripts take action if a particular user belongs to a specific group. Here's how to use IfMember to determine whether the current user is part of the Administrators group:

ifmember Administrators
if errorlevel 1 echo The user is in the Administrators group

7. LogEvent lets your NT command script write entries into a local or remote NT system's application event log. Here's how to use LogEvent to write an information message:

logevent "Batch Job Completed"

6. Dumpel lets you dump event-log contents to a text file, which you can then process using commands such as For, Findstr, and Munge. Here's how to dump MyServer's system event log to the myevents.txt file:

dumpel -f C:\temp\myevents.txt -s MyServer -l system

5. Munge lets you find and replace strings in text files. Munge is handy because it lets you update your batch files when you need to make mass changes to several scripts. The command uses a script file that contains the from and to strings that will change. Here's how to update the myscript.cmd file using the strings contained in the file changes.txt:

munge changes.txt myscript.cmd

4. Robocopy can copy a single file, multiple files (using wildcards), and full directory trees. Robocopy's ability to retry after network errors makes it superior to NT's standard Copy command. Here's how to copy a directory named scripts from MyServer1 to MyServer2:

robocopy "//MyServer1\scripts" "//MyServer2\scripts"

3. Choice presents a simple set of choices to the end user. Windows 9x includes Choice in its command shell, but the command is missing in NT. Fortunately, its inclusion in the resource kit lets you use Choice in your NT command scripts. Here's a typical example of how to use Choice:

choice Enter Y to Run or N to Cancel

2. Now displays the current date and time. When you use Now in conjunction with redirection, you can log the completion of scripts. Here's how to use Now to write a time-stamped entry into a file named mylog.txt:

now command script completed>mylog.txt

1. Sleep and TimeOut are two of the resource kit's most vital batch file commands. Both commands let your NT command script suspend execution for a set time period (e.g., 60 seconds):

sleep 60
timeout 60

TimeOut resumes execution when the user presses any key.

End of Article



Reader Comments
How do I get teh "Resource Kit Batch File Commands"
Thanks

Shaya Rotem April 21, 2002


I'm a windows2000 user.
I'm enjoy in tools!
How can i get it?

tjaofeng November 08, 2002


I am interested in tools about batch files. I would like to automate several task using batch files.

Aroldo Portillo October 26, 2003


It made me more interested. My need however is to copy a big file in a window 2000 environment and name it to the date it was done. I intend to use it as a backup command.

Ray Tangunan January 25, 2004


i'm interested in some resources for beginners. I'm trying to get a firm grasp on XP and 2000 and was looking for a good starting place

Derek Ehrman March 28, 2004


I really need those commands in my server. I'm glad to find your kit.Thanks

Giovanni Casanova May 21, 2004


Ray, if you haven't already figured, re: " to copy a big file in a window 2000 environment and name it to the date it was done"...
1- per Regional in Control Panel, set the date delimiter to "-" (dash).
2- copy NeededFile.ext %date%.ext
That will copy as desired. HTH!

TP May 29, 2004


I'm trying to create to batch file that would be started in a scheduled task. My question is how can I loop the batch file to run until it finds the file(s) needs then end once the task is done. For example: The scheduled task is for 1am but the files comes in later @ 1:30am.
How can I make the batch file loop until the file(s) needed arrive? Thank you.

Marlo June 10, 2004


I am running a program with a batch file and am left with an open dos window, I would like to leave the program running and minimize the dos window to the taskbar, am running windows 2000

stephen June 10, 2004


if any one can tell me how to hack into my using only the I.P or computer name please e-mail me at bli0001@ballaraths.vic.edu.au

Anonymous User December 12, 2004


 See More Comments  1   2 

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Battery Life Issues Almost Certainly Not Windows 7's Fault

While Microsoft is still investigating a notebook battery life issue that was supposedly caused by Windows 7, some interesting trends have emerged. ...

Confirmed: Battery Life Issues Not Windows 7's Fault

Microsoft on Monday issued a lengthy statement about the recent Windows 7 battery controversy, echoing my assessment from earlier in the day, but backing it up with hard, cold evidence. ...

Getting your iPhone to Sync with Exchange 2003

Follow these steps to use an iPhone with Exchange. ...


Windows OSs Whitepapers Protecting Microsoft SharePoint

Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2010 Penton Media, Inc. Terms of Use | Privacy Statement