Customing Scripts and Batch Files with Environment Variables

|
Rather Have Fast and Secure Remote
Control?
|
One of the most popular uses of environment variables is from within batch files. For example, you could add the following commands to an existing logon script to provide users with basic information:
@echo Thank you for logging on %username%.
@echo The current time is %time% on %date%.
@echo Your user profile is located in %userprofile%.
@echo Your home directory is located at %homedrive%
pause
By the same token, information provided by variables could be used within a script to make decisions. For example, an administrator might choose to copy a file to a system if the %os% variable equals Windows_NT, using an IF statement.
If scripting isn’t your thing, you can still manipulate variables to serve your needs. For example, you could create your own new user variable called HIDDEN that points to a folder that you have hidden from view with the file system, and then use the %hidden% variable when you want to access that folder quickly. Similarly, you could also change the path of temporary file locations (the TMP and TEMP) variables such that all temporary files are saved to a single folder named D:\tempfolder, thus making it easier to delete or find temporary files when necessary.
Written by Dan DiNicolo - Visit WebsiteNext post in Tweaking XP:
Configuring Windows XP Date and Time Settings
Previous post in Tweaking XP:
Viewing and Changing Windows XP Variables
All Tutorials by Category:
- CCDA Study Guide
- CCNA Study Guide Chapter 01
- CCNA Study Guide Chapter 02
- CCNA Study Guide Chapter 03
- CCNA Study Guide Chapter 04
- CCNA Study Guide Chapter 05
- CCNA Study Guide Chapter 06
- CCNA Study Guide Chapter 07
- CCNA Study Guide Chapter 08
- CCNA Study Guide Chapter 09
- CCNA Study Guide Chapter 10
- CCNA Study Guide Chapter 11
- CCNA Study Guide Chapter 12
- Cognos
- Computer Hardware
A
C
D
E
F
G
H
I
L
M
N
Entire site Copyright © 1999-2007 2000Trainers.com, all rights reserved.
Content on this site may not be copied or reproduced in any way without permission.


