- Как удалить PowerShell в Windows 10
- Как вернуть командную строку вместо PowerShell в Windows 10
- Как отключить PowerShell в Windows 10
- Программы и компоненты
- Windows PowerShell
- Uninstall-Module
- Syntax
- Description
- Examples
- Example 1: Uninstall a module
- Example 2: Use the pipeline to uninstall a module
- Parameters
- Remove-Item
- Syntax
- Description
- Examples
- Example 1: Delete files that have any file name extension
- Example 2: Delete some of the document files in a folder
- Example 3: Delete hidden, read-only files
- Example 4: Delete files in subfolders recursively
- Example 5: Delete subkeys recursively
- Example 6: Deleting files with special characters
- Example 7: Remove an alternate data stream
- Parameters
- Inputs
- Outputs
- Notes
Как удалить PowerShell в Windows 10
Оболочка Windows PowerShell пришла в операционную систему Windows 10 на замену командной строки, хотя командная строка также получила обновление и возможность вставки команд с буфера обмена. Поскольку большинство пользователей привыкли к обычной командной строке, то даже замена пункта командной строки на оболочку PowerShell может показаться навязчивой.
Данная статья расскажет как удалить Windows PowerShell и вернуть командную строку вместо PowerShell в Windows 10. Процесс удаления оболочки заключается в отключении компонента Windows PowerShell 2.0 или же только в замене пункта в контекстном меню. Обратите внимание, что полностью убрать оболочку Windows PowerShell не удастся, даже после полного отключения компонента.
Как вернуть командную строку вместо PowerShell в Windows 10
С выходом нового обновления операционной системы в контекстном меню пуска была сделана замена возможности выбора командной строки на Windows PowerShell. Корпорация Майкрософт оставила за пользователями возможность возврата командной строки вместо PowerShell.
- Открываем Пуск > Параметры > Персонализация > Панель задач.
- Дальше изменяем значение пункта Заменить командную строку оболочкой Windows PowerShell в меню, которое появляется при щелчке правой кнопкой мыши по кнопке Пуск или при нажатии клавиш Windows+X на Отключено.
После чего в контекстном меню пуск появится доступная ранее командная строка. Смотрите также другие способы запуска командной строки в Windows 10. А также заменить PowerShell на командную строку можно использую редактор реестра. Обратите внимание что перед внесением изменений в реестр рекомендуется создать резервную копию реестра, а после внесения изменений необходимо выполнить перезагрузку компьютера или перезапуск проводника.
- Откройте редактор реестра выполнив команду regedit в окне Win+R.
- Дальше перейдите в расположение: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced.
- Измените значение параметра DontUsePowerShellOnWinX на 1.
Как отключить PowerShell в Windows 10
Программы и компоненты
Ранее мы уже рассматривали где находятся программы и компоненты в Windows 10, среди которых и присутствует оболочка Windows PowerShell 2.0. Включение и отключение компонента позволяет добавить или удалить оболочку Windows PowerShell в Windows 10. Полностью удалить компонент из системы последней версии не получится, и собственно в этом нет необходимости.
- Откройте компоненты Windows выполнив команду optionalfeatures в окне Win+R.
- Дальше найдите в открывшемся списке компонент Windows PowerShell 2.0 и отключите его.
Чтобы отключить компонент, достаточно снять его флажок и применить изменения. Затемненный флажок означает, что компонент включен частично.
Windows PowerShell
Для отключения компонента можно использовать сам компонент Windows PowerShell. Пользователю достаточно запустить оболочку PowerShell и выполнить одну команду для отключения любого с компонентов.
- Запускаем оболочку выбрав в результатах поиска классическое приложение Windows PowerShell от имени администратора.
- В открывшемся окне выполняем следующую команду: [stextbox -Online -FeatureName MicrosoftWindowsPowerShellV2Root[/stextbox]
С помощью одной команды можно отключить ненужный компонент Windows PowerShell устаревшей версии. После отключения обновленный PowerShell пятой версии останется доступным.
Вместе с обновлениями Windows 10 обновляются и компоненты операционной системы. Изменения потерпели множество компонентов, начиная от оболочки Windows PowerShelll, и включительно до компонента виртуализации Hyper-V Windows 10.
После отключения компонента Windows PowerShell второй версии обновленный PowerShell останется. Но пользователи предпочитающие видеть командную строку в контекстном меню пуск могут нажатием одной кнопки её вернуть.
Uninstall-Module
Uninstalls a module.
Syntax
Description
The Uninstall-Module cmdlet uninstalls a specified module from the local computer. You can’t uninstall a module if it has other modules as dependencies.
Examples
Example 1: Uninstall a module
This example uninstalls a module.
Uninstall-Module uses the Name parameter to specify the module to uninstall from the local computer.
Example 2: Use the pipeline to uninstall a module
In this example, the pipeline is used to uninstall a module.
Get-InstalledModule uses the Name parameter to specify the module. The object is sent down the pipeline to Uninstall-Module and is uninstalled.
Parameters
Allows you to uninstall a module marked as a prerelease.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies that you want to include all available versions of a module. You can’t use the AllVersions parameter with the MinimumVersion, MaximumVersion, or RequiredVersion parameters.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the Uninstall-Module .
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Forces Uninstall-Module to run without asking for user confirmation.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Accepts a PSRepositoryItemInfo object. For example, output Get-InstalledModule to a variable and use that variable as the InputObject argument.
Type: | PSObject [ ] |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the maximum, or newest, version of the module to uninstall. The MaximumVersion and RequiredVersion parameters can’t be used in the same command.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the minimum version of the module to uninstall. The MinimumVersion and RequiredVersion parameters can’t be used in the same command.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies an array of module names to uninstall.
Type: | String [ ] |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the exact version number of the module to uninstall.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if Uninstall-Module runs. The cmdlet isn’t run.
Remove-Item
Deletes the specified items.
Syntax
Description
The Remove-Item cmdlet deletes one or more items. Because it is supported by many providers, it can delete many different types of items, including files, folders, registry keys, variables, aliases, and functions.
Examples
Example 1: Delete files that have any file name extension
This example deletes all of the files that have names that include a dot ( . ) from the C:\Test folder. Because the command specifies a dot, the command does not delete folders or files that have no file name extension.
Example 2: Delete some of the document files in a folder
This example deletes from the current folder all files that have a .doc file name extension and a name that does not include *1* .
It uses the wildcard character ( * ) to specify the contents of the current folder. It uses the Include and Exclude parameters to specify the files to delete.
Example 3: Delete hidden, read-only files
This command deletes a file that is both hidden and read-only.
It uses the Path parameter to specify the file. It uses the Force parameter to delete it. Without Force, you cannot delete read-only or hidden files.
Example 4: Delete files in subfolders recursively
This command deletes all of the CSV files in the current folder and all subfolders recursively.
Because the Recurse parameter in Remove-Item has a known issue, the command in this example uses Get-ChildItem to get the desired files, and then uses the pipeline operator to pass them to Remove-Item .
In the Get-ChildItem command, Path has a value of ( * ), which represents the contents of the current folder. It uses Include to specify the CSV file type, and it uses Recurse to make the retrieval recursive. If you try to specify the file type the path, such as -Path *.csv , the cmdlet interprets the subject of the search to be a file that has no child items, and Recurse fails.
Example 5: Delete subkeys recursively
This command deletes the «OldApp» registry key and all its subkeys and values. It uses Remove-Item to remove the key. The path is specified, but the optional parameter name (Path) is omitted.
The Recurse parameter deletes all of the contents of the «OldApp» key recursively. If the key contains subkeys and you omit the Recurse parameter, you are prompted to confirm that you want to delete the contents of the key.
Example 6: Deleting files with special characters
The following example shows how to delete files that contain special characters like brackets or parentheses.
Example 7: Remove an alternate data stream
This example shows how to use the Stream dynamic parameter of the Remove-Item cmdlet to delete an alternate data stream. The stream parameter is introduced in Windows PowerShell 3.0.
The Stream parameter Get-Item gets the Zone.Identifier stream of the Copy-Script.ps1 file. Remove-Item uses the Stream parameter to remove the Zone.Identifier stream of the file. Finally, the Get-Item cmdlet shows that the Zone.Identifier stream was deleted.
Parameters
Prompts you for confirmation before running the cmdlet. For more information, see the following articles:
- about_Preference_Variables
- about_Functions_CmdletBindingAttribute
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
This parameter is not supported by any providers installed with PowerShell. To impersonate another user, or elevate your credentials when running this cmdlet, use Invoke-Command.
Type: | PSCredential |
Position: | Named |
Default value: | Current user |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as *.txt . Wildcard characters are permitted. The Exclude parameter is effective only when the command includes the contents of an item, such as C:\Windows\* , where the wildcard character specifies the contents of the C:\Windows directory.
Type: | String [ ] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies a filter to qualify the Path parameter. The FileSystem provider is the only installed PowerShell provider that supports the use of filters. You can find the syntax for the FileSystem filter language in about_Wildcards. Filters are more efficient than other parameters, because the provider applies them when the cmdlet gets the objects rather than having PowerShell filter the objects after they are retrieved.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Forces the cmdlet to remove items that cannot otherwise be changed, such as hidden or read-only files or read-only aliases or variables. The cmdlet cannot remove constant aliases or variables. Implementation varies from provider to provider. For more information, see about_Providers. Even using the Force parameter, the cmdlet cannot override security restrictions.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as «*.txt» . Wildcard characters are permitted. The Include parameter is effective only when the command includes the contents of an item, such as C:\Windows\* , where the wildcard character specifies the contents of the C:\Windows directory.
Type: | String [ ] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies a path to one or more locations. The value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.
Type: | String [ ] |
Aliases: | PSPath, LP |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies a path of the items being removed. Wildcard characters are permitted.
Type: | String [ ] |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | True |
Indicates that this cmdlet deletes the items in the specified locations and in all child items of the locations.
When it is used with the Include parameter, the Recurse parameter might not delete all subfolders or all child items. This is a known issue. As a workaround, try piping results of the Get-ChildItem -Recurse command to Remove-Item , as described in «Example 4» in this topic.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
This Parameter is only available on Windows.
The Stream parameter is a dynamic parameter that the FileSystem provider adds to Remove-Item . This parameter works only in file system drives.
You can use Remove-Item to delete an alternative data stream, such as Zone.Identifier . However, it is not the recommended way to eliminate security checks that block files that are downloaded from the Internet. If you verify that a downloaded file is safe, use the Unblock-File cmdlet.
This parameter was introduced in Windows PowerShell 3.0.
Type: | String [ ] |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
You can pipe a string that contains a path, but not a literal path, to this cmdlet.
Outputs
None
This cmdlet does not return any output.
Notes
The Remove-Item cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type Get-PsProvider . For more information, see about_Providers.
When you try to delete a folder that contains items without using the Recurse parameter, the cmdlet prompts for confirmation. Using -Confirm:$false does not suppress the prompt. This is by design.