Windows powershell exe path

Содержание
  1. Путь к Powershell.exe(v 2.0)
  2. Запуск Windows PowerShell Starting Windows PowerShell
  3. В PowerShell Core есть переименованный двоичный файл PowerShell Core has renamed binary
  4. Запуск Windows PowerShell в более ранних версиях Windows How to Start Windows PowerShell on Earlier Versions of Windows
  5. Из меню «Пуск» From the Start Menu
  6. В командной строке At the Command Prompt
  7. С правами администратора (Запуск от имени администратора) With Administrative privileges (Run as administrator)
  8. Запуск интегрированной среды сценариев Windows PowerShell в более ранних версиях Windows How to Start Windows PowerShell ISE on Earlier Releases of Windows
  9. Из меню «Пуск» From the Start Menu
  10. В командной строке At the Command Prompt
  11. С правами администратора (Запуск от имени администратора) With Administrative privileges (Run as administrator)
  12. Включение интегрированной среды сценариев Windows PowerShell в более ранних версиях Windows How to Enable Windows PowerShell ISE on Earlier Releases of Windows
  13. Включение интегрированной среды сценариев Windows PowerShell Windows PowerShell (ISE) To enable Windows PowerShell Integrated Scripting Environment (ISE)
  14. Запуск 32-разрядной версии Windows PowerShell Starting the 32-Bit Version of Windows PowerShell
  15. Управление текущим расположением Managing Current Location
  16. Получение текущего расположения (Get-Location) Getting Your Current Location (Get-Location)
  17. Настройка текущего расположения (Set-Location) Setting Your Current Location (Set-Location)
  18. Сохранение и отзыв последних расположений (Push-Location и Pop-Location) Saving and Recalling Recent Locations (Push-Location and Pop-Location)

Путь к Powershell.exe(v 2.0)

Где находится Powershell (версия 2.0)? Каков путь к Powershell.exe? У меня установлены Windows Server 2008 и Powershell. Когда я смотрю на эту папку:

У меня есть только Powershell v1.0. Но когда я печатаю

Это показывает, что у меня установлен v2.0.

Я верю в это в C:\Windows\System32\WindowsPowershell\v1.0\ . Чтобы запутать невиновных, MS хранила его в каталоге с надписью “v1.0”. Выполнение этого в Windows 7 и проверка номера версии с помощью $Host.Version (определить установленную версию PowerShell) показывает его 2.0.

Другой вариант – введите $PSVersionTable в командной строке. Если вы работаете с версией 2.0, вывод будет:

Если вы работаете с версией 1.0, переменная не существует, и выходных данных не будет.

Локализация PowerShell версии 1.0, 2.0, 3.0, 4.0:

  • 64-разрядная версия: C:\Windows\System32\WindowsPowerShell\v1.0\
  • 32-разрядная версия: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\

Я думаю, что у $PsHome есть информация, которую вы ищете?

Вот один из способов…

Возможно, это лучший способ, так как он возвращает первый хит на пути, точно так же, как если бы вы запускали Powershell из командной строки…

Это всегда C:\Windows\System32\WindowsPowershell\v1.0. Это было так, что для обратной совместимости это то, что я слышал или где-то читал.

Знаете ли вы, где находится официальная страница PowerShell, указывающая, что это всегда: “C:\Windows\System32\WindowsPowershell\v1.0”?

Запуск Windows PowerShell Starting Windows PowerShell

Windows PowerShell — это обработчик скриптов .DLL , который внедрен в несколько узлов. Windows PowerShell is a scripting engine .DLL that’s embedded into multiple hosts. Самый распространенный запускаемый узел — интерактивная командная строка powershell.exe и интерактивная среда скриптов powershell_ise.exe . The most common hosts you’ll start are the interactive command-line powershell.exe and the Interactive Scripting Environment powershell_ise.exe .

Информацию о запуске Windows PowerShell® в Windows Server® 2012 R2, Windows® 8.1, Windows Server 2012 и Windows 8 см. в статье Общие задачи управления и навигации в Windows. To start Windows PowerShell® on Windows Server® 2012 R2, Windows® 8.1, Windows Server 2012, and Windows 8, see Common Management Tasks and Navigation in Windows.

В PowerShell Core есть переименованный двоичный файл PowerShell Core has renamed binary

PowerShell Core, или PowerShell, имеет версию 6 и выше с открытым исходным кодом и использует .NET Core. PowerShell Core, referred to as PowerShell, is version 6 and higher that’s open source and uses .NET Core. Поддерживаемые версии доступны в Windows, macOS и Linux. Supported versions are available on Windows, macOS, and Linux.

Начиная с PowerShell 6 двоичный файл PowerShell был переименован в pwsh.exe для Windows и pwsh для macOS и Linux. Beginning in PowerShell 6, the PowerShell binary was renamed pwsh.exe for Windows and pwsh for macOS and Linux. Вы можете запустить предварительную версию PowerShell с помощью pwsh-preview . You can start PowerShell preview versions using pwsh-preview . Дополнительные сведения см. в разделе Новые возможности в PowerShell Core 6.0 и Сведения о pwsh. For more information, see What’s New in PowerShell Core 6.0 and About pwsh.

Чтобы найти справку по командлетам и документацию по установке для PowerShell 7, воспользуйтесь следующими ссылками: To find cmdlet reference and installation documentation for PowerShell 7, use the following links:

Документ Document Ссылка Link
Справка по командлетам Cmdlet reference Обозреватель модулей PowerShell PowerShell Module Browser
Установка в Windows Windows installation Установка PowerShell Core в Windows Installing PowerShell Core on Windows
Установка в macOS macOS installation Установка PowerShell Core в macOS Installing PowerShell Core on macOS
Установка в Linux Linux installation Установка PowerShell Core в Linux Installing PowerShell Core on Linux

Сведения о других версиях PowerShell см. в документации по использованию PowerShell. To view content for other PowerShell versions, see How to use the PowerShell documentation.

Запуск Windows PowerShell в более ранних версиях Windows How to Start Windows PowerShell on Earlier Versions of Windows

В этом разделе объясняется, как запустить Windows PowerShell и интегрированную среду скриптов Windows PowerShell (ISE) в Windows® 7, Windows Server® 2008 R2 и Windows Server® 2008. This section explains how to start Windows PowerShell and Windows PowerShell Integrated Scripting Environment (ISE) on Windows® 7, Windows Server® 2008 R2, and Windows Server® 2008. Кроме того, здесь поясняется, как включить дополнительный компонент Windows PowerShell ISE в Windows PowerShell 2.0 в ОС Windows Server® 2008 R2 и Windows Server® 2008. It also explains how to enable the optional feature for Windows PowerShell ISE in Windows PowerShell 2.0 on Windows Server® 2008 R2 and Windows Server® 2008.

Используйте любой из следующих методов для запуска установленной версии Windows PowerShell 3.0 или Windows PowerShell 4.0, где это возможно. Use any of the following methods to start the installed version of Windows PowerShell 3.0, or Windows PowerShell 4.0, where applicable.

Из меню «Пуск» From the Start Menu

  • Нажмите кнопку Пуск , введите PowerShell и выберите Windows PowerShell. Click Start , type PowerShell , and then click Windows PowerShell.
  • В меню Пуск выберите Пуск , Все программы , Стандартные , откройте папку Windows PowerShell и щелкните Windows PowerShell. From the Start menu, click Start , click All Programs , click Accessories , click the Windows PowerShell folder, and then click Windows PowerShell.

В командной строке At the Command Prompt

В cmd.exe , Windows PowerShell или интегрированной среде сценариев Windows PowerShell для запуска Windows PowerShell введите следующее: In cmd.exe , Windows PowerShell, or Windows PowerShell ISE, to start Windows PowerShell, type:

Можно также использовать параметры программы powershell.exe для настройки сеанса. You can also use the parameters of the powershell.exe program to customize the session. Дополнительные сведения см. в статье Справка по командной строке PowerShell.exe. For more information, see PowerShell.exe Command-Line Help.

С правами администратора (Запуск от имени администратора) With Administrative privileges (Run as administrator)

Нажмите кнопку Пуск , введите PowerShell , щелкните правой кнопкой мыши Windows PowerShell и выберите пункт Запуск от имени администратора. Click Start , type PowerShell , right-click Windows PowerShell , and then click Run as administrator.

Запуск интегрированной среды сценариев Windows PowerShell в более ранних версиях Windows How to Start Windows PowerShell ISE on Earlier Releases of Windows

Используйте один из следующих методов для запуска интегрированной среды сценариев Windows PowerShell. Use any of the following methods to start Windows PowerShell ISE.

Из меню «Пуск» From the Start Menu

  • Нажмите кнопку Пуск , введите Интегрированная среда сценариев и выберите Интегрированная среда сценариев Windows PowerShell. Click Start , type ISE , and then click Windows PowerShell ISE.
  • В меню Пуск выберите Пуск , Все программы , Стандартные , откройте папку Windows PowerShell и щелкните Интегрированная среда сценариев Windows PowerShell. From the Start menu, click Start , click All Programs , click Accessories , click the Windows PowerShell folder, and then click Windows PowerShell ISE.

В командной строке At the Command Prompt

В cmd.exe , Windows PowerShell или интегрированной среде сценариев Windows PowerShell для запуска Windows PowerShell введите следующее: In cmd.exe , Windows PowerShell, or Windows PowerShell ISE, to start Windows PowerShell, type:

С правами администратора (Запуск от имени администратора) With Administrative privileges (Run as administrator)

Нажмите кнопку Пуск , введите Интегрированная среда сценариев , щелкните правой кнопкой мыши Интегрированная среда сценариев Windows PowerShell и выберите пункт Запуск от имени администратора. Click Start , type ISE , right-click Windows PowerShell ISE , and then click Run as administrator.

Включение интегрированной среды сценариев Windows PowerShell в более ранних версиях Windows How to Enable Windows PowerShell ISE on Earlier Releases of Windows

При использовании Windows PowerShell 4.0 и Windows PowerShell 3.0 интегрированная среда сценариев Windows PowerShell по умолчанию включена во всех версиях Windows. In Windows PowerShell 4.0 and Windows PowerShell 3.0, Windows PowerShell ISE is enabled by default on all versions of Windows. Если она еще не включена, Windows Management Framework 4.0 или Windows Management Framework 3.0 включает ее. If it isn’t already enabled, Windows Management Framework 4.0 or Windows Management Framework 3.0 enables it.

При использовании Windows PowerShell 2.0 интегрированная среда сценариев Windows PowerShell по умолчанию включена в Windows 7. In Windows PowerShell 2.0, Windows PowerShell ISE is enabled by default on Windows 7. В Windows Server 2008 R2 и Windows Server 2008 эта функция является дополнительной. However, on Windows Server 2008 R2 and Windows Server 2008, it’s an optional feature.

Чтобы включить интегрированную среду сценариев Windows PowerShell для Windows PowerShell 2.0 в Windows Server 2008 R2 или Windows Server 2008, выполните указанные ниже действия. To enable Windows PowerShell ISE in Windows PowerShell 2.0 on Windows Server 2008 R2 or Windows Server 2008, use the following procedure.

Включение интегрированной среды сценариев Windows PowerShell Windows PowerShell (ISE) To enable Windows PowerShell Integrated Scripting Environment (ISE)

  1. Запустите диспетчер серверов. Start Server Manager.
  2. Щелкните Компоненты и выберите Добавить компоненты. Click Features and then click Add Features.
  3. В меню «Выберите компоненты» щелкните интегрированную среду сценариев Windows PowerShell. In Select Features, click Windows PowerShell Integrated Scripting Environment (ISE).

Запуск 32-разрядной версии Windows PowerShell Starting the 32-Bit Version of Windows PowerShell

При установке Windows PowerShell на 64-разрядном компьютере в дополнение к 64-разрядной версии устанавливается Windows PowerShell (x86) — 32-разрядная версия Windows PowerShell. When you install Windows PowerShell on a 64-bit computer, Windows PowerShell (x86) , a 32-bit version of Windows PowerShell is installed in addition to the 64-bit version. При открытии Windows PowerShell по умолчанию запускается 64-разрядная версия. When you run Windows PowerShell, the 64-bit version runs by default.

Однако в некоторых случаях нужно запустить Windows PowerShell (x86) , например при использовании модуля, которому требуется 32-разрядная версия, или при удаленном подключении к 32-разрядному компьютеру. However, you might occasionally need to run Windows PowerShell (x86) , such as when you’re using a module that requires the 32-bit version or when you’re connecting remotely to a 32-bit computer.

Для запуска 32-разрядной версии Windows PowerShell воспользуйтесь любой из следующих процедур. To start a 32-bit version of Windows PowerShell, use any of the following procedures.

Управление текущим расположением Managing Current Location

При навигации по системам папок в проводнике у вас обычно есть определенное рабочее расположение, т. е. текущая открытая папка. When navigating folder systems in File Explorer, you usually have a specific working location — namely, the current open folder. Элементами в текущей папке можно легко управлять, щелкая их. Items in the current folder can be manipulated easily by clicking them. Когда в интерфейсе командной строки (например, Cmd.exe) открыта папка, в которой находится определенный файл, вы можете получить к нему доступ, указав короткое имя, а не вводить весь путь к файлу. For command-line interfaces such as Cmd.exe, when you are in the same folder as a particular file, you can access it by specifying a relatively short name, rather than needing to specify the entire path to the file. Текущий каталог называется рабочим. The current directory is called the working directory.

Windows PowerShell использует существительное Location для ссылки на рабочий каталог и реализует семейство командлетов для просмотра расположения и управления им. Windows PowerShell uses the noun Location to refer to the working directory, and implements a family of cmdlets to examine and manipulate your location.

Получение текущего расположения (Get-Location) Getting Your Current Location (Get-Location)

Чтобы определить путь к текущему каталогу, введите команду Get-Location : To determine the path of your current directory location, enter the Get-Location command:

Командлет Get-Location аналогичен команде pwd в оболочке BASH. The Get-Location cmdlet is similar to the pwd command in the BASH shell. Командлет Set-Location аналогичен команде cd в Cmd.exe. The Set-Location cmdlet is similar to the cd command in Cmd.exe.

Настройка текущего расположения (Set-Location) Setting Your Current Location (Set-Location)

Команда Get-Location используется с командой Set-Location . The Get-Location command is used with the Set-Location command. Команда Set-Location позволяет вам указать расположение текущего каталога. The Set-Location command allows you to specify your current directory location.

Обратите внимание, что после ввода команды вы не получите прямого отклика о действии команды. After you enter the command, you will notice that you do not receive any direct feedback about the effect of the command. Большинство команд Windows PowerShell, выполняющих действия, практически не создают выходных данных, так как выходные данные не всегда полезны. Most Windows PowerShell commands that perform an action produce little or no output because the output is not always useful. Чтобы проверить успешность внесения изменения в каталог при вводе команды Set-Location , включите параметр -PassThru при вводе команды Set-Location : To verify that a successful directory change has occurred when you enter the Set-Location command, include the -PassThru parameter when you enter the Set-Location command:

Параметр -PassThru можно использовать с некоторыми командами Set в Windows PowerShell для возврата сведений о результате в случае отсутствия выходных данных по умолчанию. The -PassThru parameter can be used with many Set commands in Windows PowerShell to return information about the result in cases in which there is no default output.

Вы можете указать пути относительно текущего расположения так же, как и в большинстве командных оболочек UNIX и Windows. You can specify paths relative to your current location in the same way as you would in most UNIX and Windows command shells. В стандартной нотации для относительных путей точка ( . ) представляет текущую папку, а две точки ( .. ) — родительский каталог текущего расположения. In standard notation for relative paths, a period ( . )represents your current folder, and a doubled period ( .. ) represents the parent directory of your current location.

Например, если вы находитесь в папке C:\Windows , точка ( . ) представляет C:\Windows , а две точки ( .. ) представляют C: . For example, if you are in the C:\Windows folder, a period ( . )represents C:\Windows and double periods ( .. ) represent C: . Текущее расположение можно изменить на корень диска C: путем ввода следующей команды: You can change from your current location to the root of the C: drive by typing:

Тот же метод работает в дисках Windows PowerShell, которые не являются дисками файловой системы, например HKLM: . The same technique works on Windows PowerShell drives that are not file system drives, such as HKLM: . В реестре в качестве расположения можно задать раздел HKLM\Software путем ввода следующего кода: You can set your location to the HKLM\Software key in the registry by typing:

После этого можно изменить расположение каталога на родительский каталог, который является корнем диска Windows PowerShell HKLM: с помощью относительного пути: You can then change the directory location to the parent directory, which is the root of the Windows PowerShell HKLM: drive, by using a relative path:

Вы можете ввести Set-Location или использовать любой из встроенных псевдонимов Windows PowerShell для Set-Location (cd, chdir, sl). You can type Set-Location or use any of the built-in Windows PowerShell aliases for Set-Location (cd, chdir, sl). Пример: For example:

Сохранение и отзыв последних расположений (Push-Location и Pop-Location) Saving and Recalling Recent Locations (Push-Location and Pop-Location)

При изменении расположения полезно отслеживать свое предыдущее расположение и иметь возможность вернуться к нему. When changing locations, it is helpful to keep track of where you have been and to be able to return to your previous location. Командлет Push-Location в Windows PowerShell создает упорядоченный журнал («стек») путей к каталогам, которые вы открывали, чтобы можно было вернуться на шаг назад по журналу путей к каталогу, используя дополнительный командлет Pop-Location . The Push-Location cmdlet in Windows PowerShell creates a ordered history (a «stack») of directory paths where you have been, and you can step back through the history of directory paths by using the complementary Pop-Location cmdlet.

Например, Windows PowerShell обычно запускается в корневом каталоге пользователя. For example, Windows PowerShell typically starts in the user’s home directory.

Слово стек имеет специальное значение во многих параметрах программирования, включая .NET Framework. The word stack has a special meaning in many programming settings, including .NET Framework. Например, в физическом стеке элементов последний элемент, помещенный в стек, является первым элементом, который можно извлечь из него. Like a physical stack of items, the last item you put onto the stack is the first item that you can pull off the stack. Добавление элемента в стек в разговорной речи называется «проталкиванием» элемента в стек. Adding an item to a stack is colloquially known as «pushing» the item onto the stack. Извлечение элемента из стека в разговорной речи называется «выводом» элемента из стека. Pulling an item off the stack is colloquially known as «popping» the item off the stack.

Чтобы передать текущее расположение в стек, а затем переместить его в папку локальных параметров, введите: To push the current location onto the stack, and then move to the Local Settings folder, type:

После этого можно передать расположение локальных параметров в стек и переместить его в папку Temp, введя следующее: You can then push the Local Settings location onto the stack and move to the Temp folder by typing:

Чтобы убедиться, что каталоги изменены, введите команду Get-Location : You can verify that you changed directories by entering the Get-Location command:

После этого можно перейти в последний открытый каталог, введя команду Pop-Location , и проверить изменение, введя команду Get-Location : You can then pop back into the most recently visited directory by entering the Pop-Location command, and verify the change by entering the Get-Location command:

Как и в случае с командлетом Set-Location , можно включить параметр -PassThru при вводе командлета Pop-Location , чтобы открыть указанный каталог: Just as with the Set-Location cmdlet, you can include the -PassThru parameter when you enter the Pop-Location cmdlet to display the directory that you entered:

Кроме того, можно использовать командлеты расположения с сетевыми путями. You can also use the Location cmdlets with network paths. Если у вас есть сервер FS01 с общей папкой Public, можно изменить расположение, введя If you have a server named FS01 with an share named Public, you can change your location by typing

Для изменения расположения на любой доступный диск можно использовать команды Push-Location и Set-Location . You can use the Push-Location and Set-Location commands to change the location to any available drive. Например, если у вас есть локальный дисковод компакт-дисков с буквой диска D, содержащий компакт-диск с данными, вы можете изменить расположение на дисковод компакт-дисков, введя команду Set-Location D: . For example, if you have a local CD-ROM drive with drive letter D that contains a data CD, you can change the location to the CD drive by entering the Set-Location D: command.

Если дисковод пуст, вы получите следующее сообщение об ошибке: If the drive is empty, you will get the following error message:

В интерфейсе командной строки проводник неудобно использовать для просмотра свободных физических дисков. When you are using a command-line interface, it is not convenient to use File Explorer to examine the available physical drives. Также в проводнике будут показаны не все диски PowerShell. Also, File Explorer would not show you the all of the Windows PowerShell drives. Windows PowerShell предоставляет набор команд для управления дисками Windows PowerShell, о которых речь пойдет далее. Windows PowerShell provides a set of commands for manipulating Windows PowerShell drives, and we will talk about these next.

Читайте также:  Dr web разблокировка windows trojan winlock
Оцените статью