Create empty file
ni file.txt -type file
ni file.txt -type file
cmd %userprofile%
powershell $env:userprofile
save as *.ps1 script
(Add-Type -MemberDefinition "[DllImport(""user32.dll"")] public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);" -Name "Win32SendMessage" -Namespace Win32Functions -PassThru)::SendMessage(-1, 0x0112, 0xF170, 2)
notepad $PROFILE
function prompt {
$cwd = $PWD.Path
if ($cwd.Length -gt 20) {
$drive = "$($cwd[0]):\..."
$lastFolder = ($cwd -split '\\')[-1]
Write-Host "$drive\" -NoNewline -ForegroundColor DarkGray
Write-Host "$lastFolder" -NoNewline -ForegroundColor Green
Write-Host "> " -NoNewLine -ForegroundColor Gray
return " "
} else {
Write-Host "$cwd> " -NoNewline #-ForegroundColor Yellow
return " "
}
}
in KB (x xxx.xKB)
Get-ChildItem -File | Where-Object { $_.Name -match "Dyn" } | Select-Object Name, @{Name="Size";Expression={ "{0:N1} KB" -f ($_.Length/1KB) }}, LastWriteTime
in MB (x.xMB)
Get-ChildItem -File | Where-Object { $_.Name -match "Dyn" } | Select-Object Name, @{Name="Size(MB)";Expression={ "{0:N1} MB" -f ($_.Length/1MB) }}, LastWriteTime
$devices = Get-ChildItem -Path HKLM:\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Devices
foreach ($device in $devices) {
$address = $device.PSChildName.ToUpper()
$name = $device.GetValue("Name")
if ($name -ne $null) {
# Convert name bytes to string if needed
$printableName = ($name -notmatch 0 | ForEach-Object {[char]$_}) -join ""
Write-Host "Address: $address, Name: $printableName"
}
}