Skip to content

Basic Windows file management with PowerShell

License

Notifications You must be signed in to change notification settings

denisecase/windows-file-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Windows File Management

Contributor Covenant License: MIT

Basic Windows file management with PowerShell

Prerequisites

Organizing Files

Windows arranges files in a tree structure, with the C:\ drive typically at the root of the tree. If a computer has been partitioned into multiple drives, you may see other drive names as well.

We can use PowerShell to create, delete, and rename folders, sub-folders, and files. It's a powerful tool for organizing your files.

For example, you may create a folder for school, and from inside that folder, create a sub-folder for each of your courses.

File Explorer

The Windows File Explorer is a graphical way of browsing files. Use this along with the PowerShell command line interface (CLI). Folders and files can be added, edited, and deleted in File Explorer as well.

Basic PowerShell Commands

PowerShell offers aliases (shortened names) for common commands. The full name is provided for additional reference [1].

  • mkdir - create new folder/directory [Create-Item]
  • cd - change directory [Set-Location]
  • cd .. - cd up to immediate parent (cd .... to go up 2 levels)
  • rm - remove [Remove-Item]
  • rni - rename item [Rename-Item]
  • ni - new item [New-Item] - even shorter than Bash 'touch' command!
  • ls - list contents [Get-ChildItem]
  • clear - clear the history of commands [Clear-Host]

Open PowerShell in User Folder

Use File Explorer to open your user folder (e.g. C:\Users\acctname). Right-click on the folder itself (showing your account name) or in the white space off to the right.

Select "Open PowerShell window here as administrator" from the context menu. If this is not yet available, see Windows Setup for Developers to add this command to your context menu.

Working with Folders

"Folders" and "directories" are the same and the terms can be used interchangeably. When using the commands, it can be helpful to think in terms of "directories". Try the following tasks - the commands are listed below.

  1. In your default user folder, create a new folder/directory named "projects".
  2. Try to create it again (the command should fail).
  3. Change into your new directory.
  4. Make several subdirectories.
  5. Move into the first subdirectory.
  6. Create an empty file (new item).
  7. Create another child directory.
  8. Rename it.
  9. Delete it.
  10. Back up to your projects directory.
  11. Back up to your user directory.
mkdir projects
mkdir projects
cd projects
mkdir proj1
mkdir proj2
mkdir proj3
cd proj1
ni README.md
mkdir startup
rni startup startingup
rm startingup
cd ..
cd ..

Terms

  • Drive
  • File
  • File Explorer - Windows program for browsing folders and files
  • Folder / directory - a place to store files on your computerf
  • PowerShell - powerful command line interface for Windows
  • Tree data structure (every node has exactly one parent, except the root node with no parent)
  • Windows 10 - popular operating system

Next Steps

Now it's time to install some basic tools and software.

  • Follow Basic Tools to get some of the most common tools for professional software development.

See Also

About

Basic Windows file management with PowerShell

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published