Work with Directories and Files in PowerShell
Utilities
cd.. | go back one directory |
cd directoryName | go to the child directory |
cd some\path\to\some\descendent\directory | go to the descendent directory |
dir | list the contents of the current directory |
location | display the current directory |
ii . | open the current directory in Windows Explorer |
any-command | out-null | suppress console output |
get-help any-command | get help for a command |
get-alias –definition any-command | list a commands aliases |
get-alias anyAlias | list an alias’s command |
cd "c:\users\$env:username\desktop" | go to the desktop, with the %username% variable |
Create, Delete, and Move Files or Folders
- New-Item
- Remove-Item
- Move-Item
See also http://technet.microsoft.com/en-us/library/5a761ad4-9a3e-4bd7-abe8-27bf7c54af36
cd \ new-item parentFolder -type directorycd parentFolder new-item childFolder1 -type directory new-item childFolder2 -type directory
cd childFolder1 new-item grandChildFolder -type directory move-item grandChildFolder ..\childFolder2
cd \
delete the parent; prevent a confirmation
remove-item parentFolder –recurse
Unzip Folders
This works just as well from the dos command line.
# install 7zip and 7za cinst 7zip cinst 7zip.commandlinetest - should show help
7za
unzip (like right click, extract all)
7za x someFolder.zip