Intro
This page records some Windows PowerShell commands.
Print the full path name of specific file
We can get the full path name with "ls" fullname command. Here are the command and command output.
//List all the files
PS C:\gitroot\test_tools\taef_tests\WavTest> (ls -r).fullname
C:\gitroot\test_tools\taef_tests\WavTest\build
C:\gitroot\test_tools\taef_tests\WavTest\WavPlayTest
C:\gitroot\test_tools\taef_tests\WavTest\build_with_testcert.bat
C:\gitroot\test_tools\taef_tests\WavTest\WavTest.sln
C:\gitroot\test_tools\taef_tests\WavTest\build\build.proj
//List specific file
PS C:\gitroot\test_tools\taef_tests\WavTest> (ls .\WavTest.sln).fullname
C:\gitroot\test_tools\taef_tests\WavTest\WavTest.sln
Convert Decimal <==> Hexadecimal
Use format string with the Windows PowerShell format (-f) operator.
Standard Numeric Format Strings
Hexadecimal to Decimal
PS C:\github> 0x90
144
PS C:\github> '{0:d}' -f 0x90
144
Decimal to Hexadecimal
PS C:\github> '{0:x}' -f 144
90
PS C:\github> '{0:x}' -f 255
ff
Arithmetic Operators
PowerShell About Arithmetic Operators
PS C:\github> 1152/144
8
About Environment Variables
About Environment Variables for PowerShell.
The PowerShell environment provider lets you access Windows environment variables in PowerShell in a PowerShell drive (the Env: drive). This drive looks much like a file system drive.
Get-ChildItem Env:
Get-ChildItem: Gets the items and child items in one or more specified locations.
You can also refer to
Get-ChildItem
by its built-in aliases,ls
,dir
, andgci
.