Usage Tips:
- Click on a keyword to enable inline editing.
- Click inside a code block to copy (excludes comments).
- Use the button to view examples.
- Click outside to collapse all examples.
Show hidden files
# Show hidden files in current directory
Get-ChildItem -Force
Sample Output:
TO-DO
# Recusive
Get-ChildItem -Path '<PATH>' -Recurse -Force 2>$Null
Sample Output:
TO-DO
Find a file
ls -path '<PATH>' -Filter '<FILE>' -recurse -erroraction silent
Sample Output:
TO-DO
where /R '<PATH>' '<FILE>'
Sample Output:
TO-DO
# Find files with wildcard
Get-ChildItem -Path '<PATH>' -Recurse -Force -Include '<PATTERN>' 2>$Null
Sample Output:
*Evil-WinRM* PS C:\programdata> Get-ChildItem -Path 'C:\' -Recurse -Force -Include 'flag.*' 2>$Null
Directory: C:\Users\Administrator\Desktop
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/27/2017 4:02 PM 24 flag.txt
...[SNIP]...
Find a file, with rules
dir /s /b /a:-d-h <PATH> | findstr /i /v '<STRING>'
Sample Output:
TO-DO
+---------------------------------------+
|dir: |
|/s : include subfolders |
|/b : bare format |
|/a:-d-h : exclude directories or hidden|
| |
|findstr: |
|/i : case insensitive |
|/v STRING : exclude STRING |
+---------------------------------------+
Sample Output:
TO-DO
Find a string pattern
# Show with file name
Get-ChildItem -Recurse -Force | Select-String -Pattern "FLAG\{.*\}" -AllMatches 2>$Null
Sample Output:
TO-DO
# Show only the value
Get-ChildItem -Recurse -Force | Select-String -Pattern "FLAG\{.*\}" -AllMatches 2>$Null | % { $_.Matches } | % { $_.Value }
Sample Output:
TO-DO
Find a command location
where.exe <COMMAND>
Sample Output:
PS C:\Program Files (x86)> where.exe sqlcmd
where.exe sqlcmd
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\SQLCMD.EXE