Select all items windows

How to select or highlight multiple files and folders

When working with Microsoft Windows, macOS, (or any operating system with a GUI), you may want to select multiple files to copy, delete, or move them all at once. The following sections describe different methods of selecting multiple files or folders.

Select all the files or folders in the current directory

«Select all» with shortcut keys

In most operating systems and programs, the shortcut key Ctrl + A ( Command + A on macOS) selects all available text in the current text area, or all files in a file navigator window.

«Select all» using menus

In Windows 8 or Windows 10, the File/Edit/View menu is not available in File Explorer. Use Ctrl + A instead.

  1. Open a folder or directory in File Explorer or My Computer.
  2. Click Edit in the menu bar at the top of the window.
  3. Click Select All on the drop-down menu.

Once the files or folders are highlighted, right-click one of the highlighted files or folders to view available options to cut, copy, or delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

Mouse drag and select multiple files or folders

You can click-and-drag a box around the files or folders you want to select. Doing so selects all files and folders within that box, as shown in the animated picture.

To do this, click and hold your left mouse button on the top-left portion of where you want to start highlighting. Next, drag the box until the last file or folder is highlighted. Once the files are selected, they can be copied, cut, or dragged to another window to move them. They can also be dragged to the Trash/Recycle Bin to be deleted.

Once the files or folders are highlighted, right-click one of the highlighted files or folders to view available options, including cut, copy, or delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

Select multiple files or folders grouped together

  1. Click the first file or folder, and then press and hold the Shift key.
  2. While holding Shift , click the last file or folder.

See the other tips section on how you can select grouped and non-grouped files or folders at the same time.

Once the files or folders are highlighted, right-click one of the highlighted files or folders to view available options to cut, copy, or delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

Select multiple files or folders that are not grouped together

  1. Click the first file or folder, and then press and hold the Ctrl key.
  2. While holding Ctrl , click each of the other files or folders you want to select.

See the other tips section on how you can select grouped and non-grouped files at the same time.

Once the files or folders are highlighted, right-click one of the highlighted files or folders to view available options to cut, copy, or delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

Читайте также:  Spec comp com windows 10 64 bit

How to select without using the mouse

  1. Press Windows key + E to open File Explorer.
  2. Press Tab until you’re in the section of the window containing the files or folders you want to select.
  3. Use the arrow keys to move to the file or folder you want to select.
  4. You can select more than one file or folder by holding down the Shift key and use the arrow keys highlight them.

Once the files or folders are highlighted, press the shortcut key Ctrl + X to cut or Ctrl + C to copy, or press the Delete key to delete. For additional help and information, see the below section on what can be done after the files or folders are highlighted.

Other tips

You can use a combination of selecting multiple files or folders and single files or folders at the same time by following the steps below.

  1. Click the first file or folder you want to select.
  2. Hold down the Shift key, select the last file or folder, and then let go of the Shift key.
  3. Hold down the Ctrl key and click any other file(s) or folder(s) you would like to add to those already selected.

Holding Ctrl and clicking a file or folder a second time deselects the file or folder.

What can be done once the files or folders are highlighted?

After the files or folders are highlighted, they can be copied, moved, deleted, or compressed into a single archive file.

Select-Object

Selects objects or object properties.

Syntax

Description

The Select-Object cmdlet selects specified properties of an object or set of objects. It can also select unique objects, a specified number of objects, or objects in a specified position in an array.

To select objects from a collection, use the First, Last, Unique, Skip, and Index parameters. To select object properties, use the Property parameter. When you select properties, Select-Object returns new objects that have only the specified properties.

Beginning in Windows PowerShell 3.0, Select-Object includes an optimization feature that prevents commands from creating and processing objects that are not used.

When you include a Select-Object command with the First or Index parameters in a command pipeline, PowerShell stops the command that generates the objects as soon as the selected number of objects is generated, even when the command that generates the objects appears before the Select-Object command in the pipeline. To turn off this optimizing behavior, use the Wait parameter.

Examples

Example 1: Select objects by property

This example creates objects that have the Name, ID, and working set (WS) properties of process objects.

Example 2: Select objects by property and format the results

This example gets information about the modules used by the processes on the computer. It uses Get-Process cmdlet to get the process on the computer.

It uses the Select-Object cmdlet to output an array of [System.Diagnostics.ProcessModule] instances as contained in the Modules property of each System.Diagnostics.Process instance output by Get-Process .

The Property parameter of the Select-Object cmdlet selects the process names. This adds a ProcessName NoteProperty to every [System.Diagnostics.ProcessModule] instance and populates it with the value of current process’s ProcessName property.

Finally, Format-List cmdlet is used to display the name and modules of each process in a list.

Example 3: Select processes using the most memory

This example gets the five processes that are using the most memory. The Get-Process cmdlet gets the processes on the computer. The Sort-Object cmdlet sorts the processes according to memory (working set) usage, and the Select-Object cmdlet selects only the last five members of the resulting array of objects.

The Wait parameter is not required in commands that include the Sort-Object cmdlet because Sort-Object processes all objects and then returns a collection. The Select-Object optimization is available only for commands that return objects individually as they are processed.

Example 4: Select unique characters from an array

This example uses the Unique parameter of Select-Object to get unique characters from an array of characters.

Читайте также:  Сохранение версий файлов windows 10

Example 5: Select newest and oldest events in the event log

This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log.

Get-EventLog gets all events in the Windows PowerShell log and saves them in the $a variable. Then, $a is piped to the Select-Object cmdlet. The Select-Object command uses the Index parameter to select events from the array of events in the $a variable. The index of the first event is 0. The index of the last event is the number of items in $a minus 1.

Example 6: Select all but the first object

This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one.

Select-Object selects all but the first computer in a list of computer names. The resulting list of computers is set as the value of the ComputerName parameter of the New-PSSession cmdlet.

Example 7: Rename files and select several to review

This example adds a «-ro» suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect.

Get-ChildItem uses the ReadOnly dynamic parameter to get read-only files. The resulting files are piped to the Rename-Item cmdlet, which renames the file. It uses the Passthru parameter of Rename-Item to send the renamed files to the Select-Object cmdlet, which selects the first 5 for display.

The Wait parameter of Select-Object prevents PowerShell from stopping the Get-ChildItem cmdlet after it gets the first five read-only text files. Without this parameter, only the first five read-only files would be renamed.

Example 8: Demonstrate the intricacies of the -ExpandProperty parameter

This example demonstrates the intricacies of the ExpandProperty parameter.

Note that the output generated was an array of [System.Int32] instances. The instances conform to standard formatting rules of the Output View. This is true for any Expanded properties. If the outputted objects have a specific standard format, the expanded property might not be visible.

Example 9: Create custom properties on objects

The following example demonstrates using Select-Object to add a custom property to any object. When you specify a property name that does not exist, Select-Object creates that property as a NoteProperty on each object passed.

Example 10: Create calculated properties for each InputObject

This example demonstrates using Select-Object to add calculated properties to your input. Passing a ScriptBlock to the Property parameter causes Select-Object to evaluate the expression on each object passed and add the results to the output. Within the ScriptBlock, you can use the $_ variable to reference the current object in the pipeline.

By default, Select-Object will use the ScriptBlock string as the name of the property. Using a Hashtable, you can label the output of your ScriptBlock as a custom property added to each object. You can add multiple calculated properties to each object passed to Select-Object .

Parameters

Specifies the properties that this cmdlet excludes from the operation. Wildcards are permitted.

Beginning in PowerShell 6, it is no longer required to include the Property parameter for ExcludeProperty to work.

Type: String [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True

Specifies a property to select, and indicates that an attempt should be made to expand that property.

  • If the specified property is an array, each value of the array is included in the output.
  • If the specified property is an object, the objects properties are expanded for every InputObject

In either case, the Type of objects output will match the Type of the expanded property.

If the Property parameter is specified, Select-Object will attempt to add each selected property as a NoteProperty to every outputted object.

If you receive the error: Select : Property cannot be processed because property

already exists, consider the following. Note that when using -ExpandProperty , Select-Object can not replace an existing property. This means:

  • If the expanded object has a property of the same name, an error will occur.
  • If the Selected object has a property of the same name as an Expanded objects property, an error will occur.
Читайте также:  Почему не видит сетевой адаптер windows 10
Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Specifies the number of objects to select from the beginning of an array of input objects.

Type: Int32
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Selects objects from an array based on their index values. Enter the indexes in a comma-separated list. Indexes in an array begin with 0, where 0 represents the first value and (n-1) represents the last value.

Type: Int32 [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Specifies objects to send to the cmdlet through the pipeline. This parameter enables you to pipe objects to Select-Object .

When you pass objects to the InputObject parameter, instead of using the pipeline, Select-Object treats the InputObject as a single object, even if the value is a collection. It is recommended that you use the pipeline when passing collections to Select-Object .

Type: PSObject
Position: Named
Default value: None
Accept pipeline input: True
Accept wildcard characters: False

Specifies the number of objects to select from the end of an array of input objects.

Type: Int32
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Specifies the properties to select. These properties are added as NoteProperty members to the output objects. Wildcards are permitted.

The value of the Property parameter can be a new calculated property. To create a calculated, property, use a hash table.

Type: Object [ ]
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: True

Skips (does not select) the specified number of items. By default, the Skip parameter counts from the beginning of the array or list of objects, but if the command uses the Last parameter, it counts from the end of the list or array.

Unlike the Index parameter, which starts counting at 0, the Skip parameter begins at 1.

Type: Int32
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: Int32 [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Skips (does not select) the specified number of items from the end of the list or array. Works in the same way as using Skip together with Last parameter.

Unlike the Index parameter, which starts counting at 0, the SkipLast parameter begins at 1.

Type: Int32
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected.

This parameter is case-sensitive. As a result, strings that differ only in character casing are considered to be unique.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Indicates that the cmdlet turns off optimization. PowerShell runs commands in the order that they appear in the command pipeline and lets them generate all objects. By default, if you include a Select-Object command with the First or Index parameters in a command pipeline, PowerShell stops the command that generates the objects as soon as the selected number of objects is generated.

This parameter was introduced in Windows PowerShell 3.0.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Inputs

You can pipe any object to Select-Object .

Outputs

Notes

You can also refer to the Select-Object cmdlet by its built-in alias, select . For more information, see about_Aliases.

The optimization feature of Select-Object is available only for commands that write objects to the pipeline as they are processed. It has no effect on commands that buffer processed objects and write them as a collection. Writing objects immediately is a cmdlet design best practice. For more information, see Write Single Records to the Pipeline in Strongly Encouraged Development Guidelines.

Оцените статью