Windows Batch Scripting/Environment Commands

4. Environment Commands

edit

This chapter covers the following commands:

  • Netstat -n = shows all the computers in your network
  • Shutdown -i = opens the remote shutdown log. where you can shut down any computer in your network.
  • ASSOC - Displays or modifies file extension associations.
  • AT - Schedules commands and programs to run on a computer.
  • DATE - Displays or sets the date.
  • FTYPE - Displays or modifies file types used in file extension associations.
  • LABEL - Creates, changes, or deletes the volume label of a disk.
  • PATH - Displays or sets a search path for executable files.
  • SET - Displays, sets, or removes Windows environment variables.
  • SUBST - Associates a path with a drive letter.
  • TIME - Displays or sets the system time.
  • VER - Displays the Windows version.
  • VOL - Displays a disk volume label and serial number.

The DATE Command

edit

This command displays or sets the current date.

C:\WB>DATE
The current date is: 06/12/2008
Enter the new date: (dd-mm-yy) 01-01-2009

C:\WB>DATE
The current date is: 01/01/2009
Enter the new date: (dd-mm-yy)

C:\WB>DATE /T
01/01/2009

C:\WB>DATE
The current date is: 01/01/2009
Enter the new date: (dd-mm-yy) 06-12-2008

C:\WB>DATE /T
06/12/2008

C:\WB>

Is there any way of changing the date format?

The SUBST Command

edit

It is sometimes useful to be able to associate paths with drive letters.

C:\>SUBST H: bea\user_projects\domains

C:\>