From 87e3fa4b89e7d9de1ca645d11a6ab41c7ae3e140 Mon Sep 17 00:00:00 2001 From: aplteam Date: Wed, 5 Sep 2018 09:34:32 +0100 Subject: [PATCH] Windows Environment vars polished --- .../Appendix-01_Windows-environment-vars.html | 47 ++++----- HTML/Dyalog_Cookbook.html | 97 ++++++++++--------- .../Appendix-01_Windows-environment-vars.md | 43 ++++---- 3 files changed, 97 insertions(+), 90 deletions(-) diff --git a/HTML/Appendix-01_Windows-environment-vars.html b/HTML/Appendix-01_Windows-environment-vars.html index 439daf9..ad5b8bc 100644 --- a/HTML/Appendix-01_Windows-environment-vars.html +++ b/HTML/Appendix-01_Windows-environment-vars.html @@ -108,19 +108,23 @@

The variables

AllUserProfile

-

Defaults to C:\ProgramData: see ProgramData

+

Defaults to C:\ProgramData: see ProgramData

- +

AppData

Defaults to C:\Users\{yourName}\AppData\Roaming

Use this to store data that is both application and user specific that is supposed to roam [2] with the user. An INI might be an example.

-

See also LocalAppData

-

###CommonProgramFiles

-

Defaults to C:\Program Files\Common Files

+

See also LocalAppData

+

CommonProgramFiles

+
+
+

Defaults to C:\Program Files\Common Files

+
+

CommonProgramFiles(x86)

@@ -154,20 +158,20 @@

ErrorLevel

HomeDrive

-

Carries the drive letter and a colon (like C:) but only if the user's data (documents, downloads, music…) do not live on a UCN path; for that see HomeShare.

+

Carries the drive letter and a colon (like C:) but only if the user's data (documents, downloads, music…) do not live on a UCN path; for that see HomeShare.

HomePath

-

Defaults to \Users\{yourName}. Note that this means it comes without the drive letter or UNC path! For a full path you need also either HomeDrive or HomeShare.

-

See also %USERPROFILE% which is usually identical to %HOMEPATH%[1] but comes with the drive letter.

+

Defaults to \Users\{yourName}. Note that this means it comes without the drive letter or UNC path! For a full path you need also either HomeDrive or HomeShare.

+

See also USERPROFILE which is usually identical with HOMEPATH[1] but comes with the drive letter.

HomeShare

-

This variable exists only of the user's data (documents, downloads, music…) live on a UNC path. See also HomePath.

+

This variable exists only of the user's data (documents, downloads, music…) live on a UNC path. See also HomePath.

LocalAppData

@@ -175,14 +179,14 @@

LocalAppData

Defaults to C:\Users\{yourName}\AppData\Local

Use this to store data that is both application and user specific that is not supposed to roam [2] with the user.

-

A log file might be an example. The reason is that when a user logs in all the data stored in %APPDATA% is copied over. A large log file might take significant time to be copied with very little (or no) benefit.

-

See also AppData.

+

A log file might be an example. The reason is that when a user logs in all the data stored in APPDATA is copied over. A large log file might take significant time to be copied with very little (or no) benefit.

+

See also AppData.

LogonServer

-

Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of LogonServer and ComputerName will be the same. In a Windows Server Domain however they will differ.

+

Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of LogonServer and ComputerName will be the same. In a Windows Server Domain however they will differ.

OS

@@ -212,7 +216,7 @@

ProgramData

ProgramFiles

-

Defaults to C:\Program Files. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to ProgramFiles(x86).

+

Defaults to C:\Program Files. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to ProgramFiles(x86).

ProgramFiles(x86)

@@ -224,7 +228,7 @@

ProgramFiles(x86)

ProgramW6432

-

Defaults to C:\Program Files. On a 64-bit version of Windows this path points to ProgramFiles. On a 32-bit version of Windows it also points to ProgramFiles which in turn points to ProgramFiles(x86).

+

Defaults to C:\Program Files. On a 64-bit version of Windows this path points to ProgramFiles. On a 32-bit version of Windows it also points to ProgramFiles which in turn points to ProgramFiles(x86).

For details see WOW64 Implementation Detail [4].

@@ -237,7 +241,7 @@

PSModulePath

Public

-

Defaults to C:\Users\Public. It contains folders like Public Documents, Public Music, Public Pictures, Public Videos, … well, you get the picture.

+

Defaults to C:\Users\Public. It contains folders like \Public Documents, \Public Music, \Public Pictures, \Public Videos, … well, you get the picture.

SystemRoot

@@ -249,13 +253,13 @@

SystemRoot

Temp

-

: Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. See also TMP.

+

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. See also TMP.

TMP

-

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. Note that the GetTempFileName API function (which is available as FilesAndDirs.GetTempFilename) will first look for the TMP environment variable and only if that does not exist for the TEMP variable.

+

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. Note that the GetTempFileName API function (which is available as FilesAndDirs.GetTempFilename) will first look for the TMP environment variable and only if that does not exist for the TEMP variable.

Username

@@ -267,20 +271,19 @@

Username

UserProfile

-

Defaults to C:\Users\{username}. That's where everything is saved that belongs to the user currently logged on. Note that this is kept apart from other user's eyes by the operating system.

-

This is usally identical[1] to %HOMEPATH% except that %HOMEPATH% does not carry the drive letter.

+

Defaults to C:\Users\{username}. That's where everything is saved that belongs to the user currently logged on.

+

This is usally identical[1] to HomePath except that HomePath does not carry the drive letter.

WinDir

-

Defaults to the value of %SystemRoot%. Deprecated.

-

It is possible to have no profile loaded, but this is a very special — and rare — case. Google for it when you run into this.

+

Defaults to the value of SystemRoot. Deprecated.


Footnotes

    -
  1. The difference between %HOMEDIR%|%HOMESHARE%\%HOMEPATH% and %USERPROFILE is that usually the are the same. However, it is possible — and relatively simple — to put the user's data (%HOME\*%) elsewhere, a network drive for example. %USERPROFILE% however is where the user's profile is loaded from, and that cannot be changed.

    +
  2. The difference between HomeDrive|HomeShare\HomePath and UserProfile is that usually they are the same. However, it is possible — and relatively simple — to put the user's data (HomePath\*) elsewhere, a network drive for example. UserProfile however is where the user's profile is loaded from, and that cannot be changed.

    Note that it is possible to have no profile loaded, but this is a very special — and rare — case. Google for it when you run into this.

  3. https://en.wikipedia.org/wiki/Roaming_user_profile

  4. https://en.wikipedia.org/wiki/PowerShell

  5. https://msdn.microsoft.com/en-us/library/windows/desktop/aa384274(v=vs.85).aspx

    diff --git a/HTML/Dyalog_Cookbook.html b/HTML/Dyalog_Cookbook.html index b1baf01..aae4475 100644 --- a/HTML/Dyalog_Cookbook.html +++ b/HTML/Dyalog_Cookbook.html @@ -8549,179 +8549,182 @@

    3. The variables

    3.1. AllUserProfile

-

Defaults to C:\ProgramData: see ProgramData

+

Defaults to C:\ProgramData: see ProgramData

- +

3.2. AppData

Defaults to C:\Users\{yourName}\AppData\Roaming

Use this to store data that is both application and user specific that is supposed to roam [2] with the user. An INI might be an example.

-

See also LocalAppData

-

###CommonProgramFiles

-

Defaults to C:\Program Files\Common Files

+

See also LocalAppData

-

3.3. CommonProgramFiles(x86)

+

3.3. CommonProgramFiles

+
+
+

Defaults to C:\Program Files\Common Files

+
+ +

3.4. CommonProgramFiles(x86)

Defaults to C:\Program Files (x86)\Common Files

-

3.4. CommonProgramW6432

+

3.5. CommonProgramW6432

Defaults to C:\Program Files\Common Files

-

3.5. ComputerName

+

3.6. ComputerName

The name of the computer

-

3.6. ComSpec

+

3.7. ComSpec

Defaults to C:\WINDOWS\system32\cmd.exe

-

3.7. ErrorLevel

+

3.8. ErrorLevel

This variable does not necessarily exist. If you execute ⎕OFF 123 in an APL application it will set ErrorLevel to 123.

-

3.8. HomeDrive

+

3.9. HomeDrive

-

Carries the drive letter and a colon (like C:) but only if the user's data (documents, downloads, music…) do not live on a UCN path; for that see HomeShare.

+

Carries the drive letter and a colon (like C:) but only if the user's data (documents, downloads, music…) do not live on a UCN path; for that see HomeShare.

-

3.9. HomePath

+

3.10. HomePath

-

Defaults to \Users\{yourName}. Note that this means it comes without the drive letter or UNC path! For a full path you need also either HomeDrive or HomeShare.

-

See also %USERPROFILE% which is usually identical to %HOMEPATH%[1] but comes with the drive letter.

+

Defaults to \Users\{yourName}. Note that this means it comes without the drive letter or UNC path! For a full path you need also either HomeDrive or HomeShare.

+

See also USERPROFILE which is usually identical with HOMEPATH[1] but comes with the drive letter.

-

3.10. HomeShare

+

3.11. HomeShare

-

This variable exists only of the user's data (documents, downloads, music…) live on a UNC path. See also HomePath.

+

This variable exists only of the user's data (documents, downloads, music…) live on a UNC path. See also HomePath.

-

3.11. LocalAppData

+

3.12. LocalAppData

Defaults to C:\Users\{yourName}\AppData\Local

Use this to store data that is both application and user specific that is not supposed to roam [2] with the user.

-

A log file might be an example. The reason is that when a user logs in all the data stored in %APPDATA% is copied over. A large log file might take significant time to be copied with very little (or no) benefit.

-

See also AppData.

+

A log file might be an example. The reason is that when a user logs in all the data stored in APPDATA is copied over. A large log file might take significant time to be copied with very little (or no) benefit.

+

See also AppData.

-

3.12. LogonServer

+

3.13. LogonServer

-

Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of LogonServer and ComputerName will be the same. In a Windows Server Domain however they will differ.

+

Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of LogonServer and ComputerName will be the same. In a Windows Server Domain however they will differ.

-

3.13. OS

+

3.14. OS

Specifies the Operating System; under Windows 10, Windows_NT

-

3.14. Path

+

3.15. Path

All the folders (separated by semicola) that the operating system should check if the user enters something like my.exe into a console window and my.exe is not found in the current directory.

-

3.15. PathExt

+

3.16. PathExt

A list of the file extensions the operating system considers executable, for example: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC.

-

3.16. ProgramData

+

3.17. ProgramData

Defaults to C:\ProgramData. Use this for information that is application-specific and needs write access after installation. For Dyalog, this would be the right place to store the session file, workspaces and user commands.

-

3.17. ProgramFiles

+

3.18. ProgramFiles

-

Defaults to C:\Program Files. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to ProgramFiles(x86).

+

Defaults to C:\Program Files. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to ProgramFiles(x86).

-

3.18. ProgramFiles(x86)

+

3.19. ProgramFiles(x86)

Defaults to C:\Program Files (x86). This is where 32-bit programs are installed.

-

3.19. ProgramW6432

+

3.20. ProgramW6432

-

Defaults to C:\Program Files. On a 64-bit version of Windows this path points to ProgramFiles. On a 32-bit version of Windows it also points to ProgramFiles which in turn points to ProgramFiles(x86).

+

Defaults to C:\Program Files. On a 64-bit version of Windows this path points to ProgramFiles. On a 32-bit version of Windows it also points to ProgramFiles which in turn points to ProgramFiles(x86).

For details see WOW64 Implementation Detail [4].

-

3.20. PSModulePath

+

3.21. PSModulePath

Defaults to C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\. This path is used by Windows Power Shell [3] to locate modules when the user does not specify the full path to a module.

-

3.21. Public

+

3.22. Public

-

Defaults to C:\Users\Public. It contains folders like Public Documents, Public Music, Public Pictures, Public Videos, … well, you get the picture.

+

Defaults to C:\Users\Public. It contains folders like \Public Documents, \Public Music, \Public Pictures, \Public Videos, … well, you get the picture.

-

3.22. SystemRoot

+

3.23. SystemRoot

Specifies the folder in which Windows is installed. Defaults to C:\WINDOWS.

-

3.23. Temp

+

3.24. Temp

-

: Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. See also TMP.

+

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. See also TMP.

-

3.24. TMP

+

3.25. TMP

-

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. Note that the GetTempFileName API function (which is available as FilesAndDirs.GetTempFilename) will first look for the TMP environment variable and only if that does not exist for the TEMP variable.

+

Points to the folder that holds temporary files and folders. Defaults to C:\Users\{username}\AppData\Local\Temp. Note that the GetTempFileName API function (which is available as FilesAndDirs.GetTempFilename) will first look for the TMP environment variable and only if that does not exist for the TEMP variable.

-

3.25. Username

+

3.26. Username

The username of the user currently logged on. Same as ⎕AN in APL.

-

3.26. UserProfile

+

3.27. UserProfile

-

Defaults to C:\Users\{username}. That's where everything is saved that belongs to the user currently logged on. Note that this is kept apart from other user's eyes by the operating system.

-

This is usally identical[1] to %HOMEPATH% except that %HOMEPATH% does not carry the drive letter.

+

Defaults to C:\Users\{username}. That's where everything is saved that belongs to the user currently logged on.

+

This is usally identical[1] to HomePath except that HomePath does not carry the drive letter.

-

3.27. WinDir

+

3.28. WinDir

-

Defaults to the value of %SystemRoot%. Deprecated.

-

It is possible to have no profile loaded, but this is a very special — and rare — case. Google for it when you run into this.

+

Defaults to the value of SystemRoot. Deprecated.


Footnotes

    -
  1. The difference between %HOMEDIR%|%HOMESHARE%\%HOMEPATH% and %USERPROFILE is that usually the are the same. However, it is possible — and relatively simple — to put the user's data (%HOME\*%) elsewhere, a network drive for example. %USERPROFILE% however is where the user's profile is loaded from, and that cannot be changed.

    +
  2. The difference between HomeDrive|HomeShare\HomePath and UserProfile is that usually they are the same. However, it is possible — and relatively simple — to put the user's data (HomePath\*) elsewhere, a network drive for example. UserProfile however is where the user's profile is loaded from, and that cannot be changed.

    Note that it is possible to have no profile loaded, but this is a very special — and rare — case. Google for it when you run into this.

  3. https://en.wikipedia.org/wiki/Roaming_user_profile

  4. https://en.wikipedia.org/wiki/PowerShell

  5. https://msdn.microsoft.com/en-us/library/windows/desktop/aa384274(v=vs.85).aspx

    diff --git a/manuscript/Appendix-01_Windows-environment-vars.md b/manuscript/Appendix-01_Windows-environment-vars.md index b8fd6e2..69721a1 100644 --- a/manuscript/Appendix-01_Windows-environment-vars.md +++ b/manuscript/Appendix-01_Windows-environment-vars.md @@ -31,19 +31,19 @@ Some consider environment variables an outdated technology. We don't want to get ### `AllUserProfile` -Defaults to `C:\ProgramData`: see [ProgramData](#programdata) +Defaults to `C:\ProgramData`: see [`ProgramData`](#programdata) -### `AppData`{#appdata} +### `AppData` Defaults to `C:\Users\{yourName}\AppData\Roaming` Use this to store data that is both application **and** user specific that is supposed to roam [^roaming] with the user. An INI might be an example. -See also **[LocalAppData](#localappdata)** +See also **[`LocalAppData`](#localappdata)** -###`CommonProgramFiles` +### `CommonProgramFiles` Defaults to `C:\Program Files\Common Files` ### `CommonProgramFiles(x86)` @@ -68,18 +68,18 @@ This variable does not necessarily exist. If you execute `⎕OFF 123` in an APL ### `HomeDrive -Carries the drive letter and a colon (like `C:`) but only if the user's data (documents, downloads, music...) do not live on a UCN path; for that see [HomeShare](#HomeShare). +Carries the drive letter and a colon (like `C:`) but only if the user's data (documents, downloads, music...) do not live on a UCN path; for that see [`HomeShare`](#HomeShare). ### `HomePath` -Defaults to `\Users\{yourName}`. Note that this means it comes **without** the drive letter or UNC path! For a full path you need also either [HomeDrive](#HomeDrive) or [HomeShare](#HomeShare). +Defaults to `\Users\{yourName}`. Note that this means it comes **without** the drive letter or UNC path! For a full path you need also either [`HomeDrive`](#HomeDrive) or [`HomeShare`](#HomeShare). -See also `%USERPROFILE%` which is usually identical to `%HOMEPATH%`[^homepath] but comes **with** the drive letter. +See also [`USERPROFILE`](#UserProfile) which is usually identical with [`HOMEPATH`](#HomePath)[^homepath] but comes **with** the drive letter. ### `HomeShare` -This variable exists only of the user's data (documents, downloads, music...) live on a UNC path. See also [HomePath](#HomeShare). +This variable exists only of the user's data (documents, downloads, music...) live on a UNC path. See also [`HomePath`](#HomeShare). ### `LocalAppData`{#localappdata} @@ -87,13 +87,13 @@ Defaults to `C:\Users\{yourName}\AppData\Local` Use this to store data that is both application **and** user specific that is **not** supposed to roam [^roaming] with the user. -A log file might be an example. The reason is that when a user logs in all the data stored in `%APPDATA%` is copied over. A large log file might take significant time to be copied with very little (or no) benefit. +A log file might be an example. The reason is that when a user logs in all the data stored in [`APPDATA`](#AppData) is copied over. A large log file might take significant time to be copied with very little (or no) benefit. -See also **[AppData](#appdata)**. +See also **[`AppData`](#AppData)**. ### `LogonServer` -Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of `LogonServer` and `ComputerName` will be the same. In a Windows Server Domain however they will differ. +Defaults to the name of the computer your are logged on to. In case of your own desktop PC the values of `LogonServer` and [`ComputerName`](#ComputerName) will be the same. In a Windows Server Domain however they will differ. ### `OS` @@ -113,7 +113,7 @@ Defaults to `C:\ProgramData`. Use this for information that is application-speci ### `ProgramFiles`{#programfiles} -Defaults to `C:\Program Files`. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to [ProgramFiles(x86)](#x86). +Defaults to `C:\Program Files`. On a 64-bit version of Windows this is where 64-bit programs are installed. Note however that on a 32-bit version of Windows this points to [`ProgramFiles(x86)`](#x86). ### `ProgramFiles(x86)`{#x86} @@ -121,7 +121,7 @@ Defaults to `C:\Program Files (x86)`. This is where 32-bit programs are installe ### `ProgramW6432` -Defaults to `C:\Program Files`. On a 64-bit version of Windows this path points to [ProgramFiles](#programfiles). On a 32-bit version of Windows it also points to `ProgramFiles` which in turn points to [ProgramFiles(x86)](#x86). +Defaults to `C:\Program Files`. On a 64-bit version of Windows this path points to [`ProgramFiles`](#programfiles). On a 32-bit version of Windows it also points to `ProgramFiles` which in turn points to [`ProgramFiles(x86)`](#x86). For details see _WOW64 Implementation Detail_ [^wow]. @@ -131,18 +131,19 @@ Defaults to `C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\`. This path is ### `Public` -Defaults to `C:\Users\Public`. It contains folders like `Public Documents`, `Public Music`, `Public Pictures`, `Public Videos`, ... well, you get the picture. +Defaults to `C:\Users\Public`. It contains folders like `\Public Documents`, `\Public Music`, `\Public Pictures`, `\Public Videos`, ... well, you get the picture. ### `SystemRoot`{#systemroot} Specifies the folder in which Windows is installed. Defaults to `C:\WINDOWS`. ### `Temp` -: Points to the folder that holds temporary files and folders. Defaults to `C:\Users\{username}\AppData\Local\Temp`. See also `TMP`. + +Points to the folder that holds temporary files and folders. Defaults to `C:\Users\{username}\AppData\Local\Temp`. See also [`TMP`](#TMP). ### `TMP` -Points to the folder that holds temporary files and folders. Defaults to `C:\Users\{username}\AppData\Local\Temp`. Note that the `GetTempFileName` API function (which is available as `FilesAndDirs.GetTempFilename`) will first look for the `TMP` environment variable and only if that does not exist for the `TEMP` variable. +Points to the folder that holds temporary files and folders. Defaults to `C:\Users\{username}\AppData\Local\Temp`. Note that the `GetTempFileName` API function (which is available as `FilesAndDirs.GetTempFilename`) will first look for the `TMP` environment variable and only if that does not exist for the [`TEMP`](#Temp) variable. ### `Username` @@ -150,17 +151,17 @@ The username of the user currently logged on. Same as `⎕AN` in APL. ### `UserProfile` -Defaults to `C:\Users\{username}`. That's where everything is saved that belongs to the user currently logged on. Note that this is kept apart from other user's eyes by the operating system. +Defaults to `C:\Users\{username}`. That's where everything is saved that belongs to the user currently logged on. -This is usally identical[^homepath] to `%HOMEPATH%` except that `%HOMEPATH%` does not carry the drive letter. +This is usally identical[^homepath] to [`HomePath`](#HomePath) except that `HomePath` does not carry the drive letter. ### `WinDir` -Defaults to the value of [`%SystemRoot%`](#systemroot). Deprecated. +Defaults to the value of [`SystemRoot`](#systemroot). Deprecated. -[^homepath]: The difference between `%HOMEDIR%|%HOMESHARE%\%HOMEPATH%` and `%USERPROFILE` is that _usually_ the are the same. However, it is possible --- and relatively simple --- to put the user's data (`%HOME\*%`) elsewhere, a network drive for example. `%USERPROFILE%` however is where the user's profile is loaded from, and that cannot be changed. +[^homepath]: The difference between `HomeDrive|HomeShare\HomePath` and `UserProfile` is that _usually_ they are the same. However, it is possible --- and relatively simple --- to put the user's data (`HomePath\*`) elsewhere, a network drive for example. `UserProfile` however is where the user's profile is loaded from, and that cannot be changed. -It is possible to have no profile loaded, but this is a very special --- and rare --- case. Google for it when you run into this. + Note that it is possible to have no profile loaded, but this is a very special --- and rare --- case. Google for it when you run into this. [^roaming]: