Skip to content

Commit 3cc8647

Browse files
committed
Corrected environment variable assignments, and reading
1 parent a0cb070 commit 3cc8647

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

articles/cognitive-services/cognitive-services-security.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: IEvangelist
77
manager: nitinme
88
ms.service: cognitive-services
99
ms.topic: conceptual
10-
ms.date: 03/18/2020
10+
ms.date: 03/23/2020
1111
ms.author: dapine
1212
---
1313

@@ -47,32 +47,50 @@ To set environment variables, use one the following commands - where the `ENVIRO
4747

4848
# [Command Line](#tab/command-line)
4949

50+
Create and assign environment variable, given the value.
51+
5052
```CMD
5153
:: Assigns the env var to the value
52-
set ENVIRONMENT_VARIABLE_KEY=value
54+
setx ENVIRONMENT_VARIABLE_KEY=value
55+
```
56+
57+
In a new instance of the **Command Prompt**, read the environment variable.
5358

59+
```CMD
5460
:: Prints the env var value
5561
echo %ENVIRONMENT_VARIABLE_KEY%
5662
```
5763

5864
# [PowerShell](#tab/powershell)
5965

66+
Create and assign environment variable, given the value.
67+
6068
```powershell
6169
# Assigns the env var to the value
62-
$Env:ENVIRONMENT_VARIABLE_KEY="value"
70+
[System.Environment]::SetEnvironmentVariable('ENVIRONMENT_VARIABLE_KEY', 'value', 'User')
71+
```
6372

73+
In a new instance of the **Windows PowerShell**, read the environment variable.
74+
75+
```powershell
6476
# Prints the env var value
65-
$Env:ENVIRONMENT_VARIABLE_KEY
77+
[System.Environment]::GetEnvironmentVariable('ENVIRONMENT_VARIABLE_KEY')
6678
```
6779

6880
# [Bash](#tab/bash)
6981

82+
Create and assign environment variable, given the value.
83+
7084
```Bash
7185
# Assigns the env var to the value
7286
export ENVIRONMENT_VARIABLE_KEY=value
87+
```
88+
89+
In a new instance of the **Bash**, read the environment variable.
7390

91+
```Bash
7492
# Prints the env var value
75-
echo ENVIRONMENT_VARIABLE_KEY
93+
echo "${ENVIRONMENT_VARIABLE_KEY}"
7694
```
7795

7896
---

0 commit comments

Comments
 (0)