Download Variables de Entorno de Windows

Document related concepts
no text concepts found
Transcript
.enREDa.
Variables de Entorno de Windows
autor Carmelo
martes, 23 de octubre de 2007
Modificado el martes, 23 de octubre de 2007
Variables de entorno de Windows
Environment Variables Windows 2000/XP
What environment variables are available in Windows?
List of the environment variables callable in windows 2000. e.g. Open a cmd prompt and type echo %appdata% which
should return the full path to your profile's Application Data directory. If calling from a batch file remember to quote the
%variable% e.g.
IF EXIST "%appdata%"\workrave\historystats. (mkdir D:\AllMyFiles\Workrave.) ELSE echo Workrave. missing
Here's the list with percentage included:
ALLUSERSPROFILE
%ALLUSERSPROFILE%
Local returns the location of the All Users Profile.
APPDATA
%APPDATA%
Local returns the location where applications store data by default.
CD
%CD%
Local returns the current directory string.
CMDCMDLINE
%CMDCMDLINE%
Local returns the exact command line used to start the current cmd.exe.
CMDEXTVERSION
%CMDEXTVERSION%
System returns the version number of the current Command Processor Extensions.
COMPUTERNAME
%COMPUTERNAME%
System returns the name of the computer.
COMSPEC
%COMSPEC%
System returns the exact path to the command shell executable.
http://carmelo.freeprohost.com
Potenciado por Joomla!
Generado: 11 July, 2017, 13:25
.enREDa.
DATE
%DATE%
System returns the current date. This variable uses the same format as the date /t command. Cmd.exe generates this
variable. For more information about the date command, see the Date command.
ERRORLEVEL
%ERRORLEVEL%
System returns the error code of the most recently used command. A non-0 value usually indicates an error.
HOMEDRIVE
%HOMEDRIVE%
System returns which local workstation drive letter is connected to the user's home directory. This variable is set based
on the value of the home directory. The user's home directory is specified in Local Users and Groups.
HOMEPATH
%HOMEPATH%
System returns the full path of the user's home directory. This variable is set based on the value of the home directory.
The user's home directory is specified in Local Users and Groups.
HOMESHARE
%HOMESHARE%
System returns the network path to the user's shared home directory. This variable is set based on the value of the home
directory. The user's home directory is specified in Local Users and Groups.
LOGONSERVER
%LOGONSERVER%
Local returns the name of the domain controller that validated the current logon session.
NUMBER_OF_PROCESSORS
%NUMBER_OF_PROCESSORS%
System specifies the number of processors installed on the computer.
OS
%OS%
System returns the OS name. Windows XP and Windows 2000 display the OS as Windows_NT.
PATH
%PATH%
System specifies the search path for executable files.
PATHEXT
%PATHEXT%
System returns a list of the file extensions that the OS considers to be executable.
http://carmelo.freeprohost.com
Potenciado por Joomla!
Generado: 11 July, 2017, 13:25
.enREDa.
PROCESSOR_ARCHITECTURE
%PROCESSOR_ARCHITECTURE%
System returns the processor's chip architecture. Values: x86, IA64.
PROCESSOR_IDENTIFIER
%PROCESSOR_IDENTIFIER%
System returns a description of the processor.
PROCESSOR_LEVEL
%PROCESSOR_LEVEL%
System returns the model number of the computer's processor.
PROCESSOR_REVISION
%PROCESSOR_REVISION%
System returns the revision number of the processor.
Program Files
%PROGRAMFILES%
returns the location of the default install directory for applications.
PROMPT
%PROMPT%
Local returns the command-prompt settings for the current interpreter. Cmd.exe generates this variable.
RANDOM
%RANDOM%
System returns a random decimal number between 0 and 32767. Cmd.exe generates this variable.
SYSTEMDRIVE
%SYSTEMDRIVE%
System returns the drive containing the Windows root directory (i.e., the system root).
SYSTEMROOT
%SYSTEMROOT%
System returns the location of the Windows root directory.
TEMP
%TEMP%
System and User return the default temporary directories for applications that are available to users who are currently
logged on. Some applications require TEMP and others require TMP.
TMP
%TMP%
http://carmelo.freeprohost.com
Potenciado por Joomla!
Generado: 11 July, 2017, 13:25
.enREDa.
System and User return the default temporary directories for applications that are available to users who are currently
logged on. Some applications require TEMP and others require TMP.
TIME
%TIME%
System returns the current time. This variable uses the same format as the time /t command. Cmd.exe generates this
variable. For more information about the time command, see the Time command.
USERDOMAIN
%USERDOMAIN%
Local returns the name of the domain that contains the user's account.
USERNAME
%USERNAME%
Local returns the name of the user currently logged on.
USERPROFILE
%USERPROFILE%
Local returns the location of the profile for the current user.
WINDIR
%WINDIR%
System returns the location of the OS directory
Algunos ejemplos de variables de usuario dinámicas son LOGONSERVER, USERDOMAIN, USERNAME, y
USERPROFILE. Algunos ejemplos de variables estáticas de usuario son path, TEMP, y TMP. La clave del Registro
HKEY_CURRENT_USER\Environment guarda variables de usuario estáticaAsignación de valores
Cuando se asigna un valor a una variable de entorno con el comando SET, el valor sólo tendrá eficacia para esa sesión.
Después de que se acabe de ejecutar el interfaz de comandos o el archivo por lotes que fija la variable, el valor dejará
de estar disponible. Para crear una variable de entorno persistente, hay que fijar el valor en el Registro como una
variable de usuario o sistema usando NT o el Kit de Recursos.
Cómo leer variables de entorno
Los archivos por lotes pueden acceder muy fácilmente a los nombres de variables especificados entre dos signos de
porcentaje. El archivo por lotes reemplaza el nombre de la variable y los dos signos de porcentaje por el valor de
variable. Por ejemplo, se puede utilizar el siguiente mandato para hacer que un archivo por lotes muestre el nombre de
usuario activo:
Echo El usuario activo es %USERNAME%
http://carmelo.freeprohost.com
Potenciado por Joomla!
Generado: 11 July, 2017, 13:25