Skip to content

Instantly share code, notes, and snippets.

@aetos382
Last active December 9, 2015 11:29
Show Gist options
  • Save aetos382/8d3e02fba9ff564ea21b to your computer and use it in GitHub Desktop.
Save aetos382/8d3e02fba9ff564ea21b to your computer and use it in GitHub Desktop.
# これは OK
gc Env:HOGE
gc Env:\HOGE
gc Environment::HOGE
# これはダメ
gc Environment::\HOGE
gc Environment::Env:HOGE
gc Environment::Env:\HOGE
# これは OK
${Env:HOGE}
${Env:\HOGE}
# これは NG
${Environment::HOGE}
${Environment::\HOGE}
${Environment::Env:HOGE}
${Environment::Env:\HOGE}
# 以下の前提が成立している時
gc 'C:\test\test.txt' -eq 'あああ'
gc 'D:\test\test.txt' -eq 'いいい'
$PWD -eq 'C:\test'
[Environment]::CurrentDirectory -eq 'D:\'
# 以下のような結果となる
gc test.txt -eq 'あああ'
gc \test\test.txt -eq 'あああ'
gc C:\test\test.txt -eq 'あああ'
gc FileSystem::test.txt -eq $null
gc FileSystem::\test\test.txt -eq 'いいい'
gc FileSystem::C:\test\test.txt -eq 'あああ'
gc Microsoft.PowerShell.Core\FileSystem::test.txt -eq $null
gc Microsoft.PowerShell.Core\FileSystem::\test\test.txt -eq 'いいい'
gc Microsoft.PowerShell.Core\FileSystem::C:\test\test.txt -eq 'あああ'
${test.txt} -eq $null
${\test\test.txt} -eq $null
${C:\test\test.txt} -eq 'あああ'
${C:test.txt} -eq 'あああ'
${D:test.txt} -eq 'いいい'
${FileSystem::test.txt} -eq $null
${FileSystem::\test\test.txt} -eq $null
${FileSystem::C:\test\test.txt} -eq $null
${Microsoft.PowerShell.Core\FileSystem::test.txt} -eq $null
${Microsoft.PowerShell.Core\FileSystem::\test\test.txt} -eq $null
${Microsoft.PowerShell.Core\FileSystem::C:\test\test.txt} -eq $null
# これは OK
gc Variable:PSHOME
gc Variable:\PSHOME
gc Variable::PSHOME
# これはダメ
gc Variable::\PSHOME
gc Variable::Variable:PSHOME
gc Variable::Variable:\PSHOME
# これは OK
${Variable:PSHOME}
# これは NG
${Variable:\PSHOME}
${Variable::PSHOME}
${Variable::\PSHOME}
${Variable::Variable:PSHOME}
${Variable::Variable:\PSHOME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment