Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- htmlFor
- appendChild
- FOR
- Openlayers
- Append
- Let
- createtextnode
- boolean
- input
- 학습법 #집중력
- createElement
- const
- VAR
Archives
- Today
- Total
Atomic Habits
What is the purpost of the &{} syntax ? 본문
https://stackoverflow.com/questions/47760921/what-is-the-purpose-of-the-syntax-operator
So ${} has two different purposes. One of them is variable declaration, as it enables you to enclose any special characters in your variable name:
${special var with spaces}
But also allows you to use it in a larger string like:
$Var="middle"
Write-Host "Before${Var}After"
Another use cases, as you are suggesting is that it is able to read paths.
$Var = ${C:\Temp\Filename.txt}
is the same as
$Var = Get-Content -Path 'C:\Temp\Filename.txt'
But also to write to a path:
${C:\Temp\Filename.txt} = 'This writes to the file!'
is the same as
'This writes to the file!' | Set-Content -Path 'C:\Temp\Filename.txt'
Comments