Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Setting path in environment variable
- $PATH = [Environment]::GetEnvironmentVariable("PATH")
- echo $PATH
- $app_path = "…"
- [Environment]::SetEnvironmentVariable("PATH", "$PATH;$winrar_path", "Machine")
- # List files in descending order of their sizes
- PS C:\Users\...\scratch> Get-ChildItem -recurse | Select-Object Name, @{Name=MegaBytes”;Expression={$_.Length / 1MB}} | Sort -Descending -Property "MegaBytes"
- # Download a file (wget alternative)
- Start-BitsTransfer -Source $url -Destination $output
- # Unzip a file using Winrar
- winrar x .\ph-export--2016.tar.gz
- # Show the contents of a file
- Get-Content file_name
- # Count number of lines
- Get-Content .\xyz.csv | Measure-Object -Line
- # Reload environment variables
- refreshenv
- # Find number of lines for all files in a directory
- Get-ChildItem *.csv | ForEach-Object { Get-Content$_.FullName | Measure-Object -Line } | Format-Wide -Property Lines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement