博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
powershell快捷键_在PowerShell中使用别名添加快捷方式
阅读量:2514 次
发布时间:2019-05-11

本文共 2412 字,大约阅读时间需要 8 分钟。

powershell快捷键

powershell快捷键

A hard working admin is constantly opening and closing multiple programs to get work done. When you’re working in PowerShell, we can use aliases to make switching to a new program as fast as possible.

努力工作的管理员会不断打开和关闭多个程序以完成工作。 当您在PowerShell中工作时,我们可以使用别名来尽可能快地切换到新程序。

We’ll first need to find the folder location of the program executable. We’re using Notepad in our example, which is located in “C:WindowsSystem32notepad.exe”

我们首先需要找到程序可执行文件的文件夹位置。 我们在示例中使用的是记事本,该示例位于“ C:WindowsSystem32notepad.exe”中

sshot-2010-01-01-04-33-51

Next we’ll open PowerShell and enter:

接下来,我们将打开PowerShell并输入:

new-item alias:np -value C:WindowsSystem32notepad.exe

新项目别名:np -value C:WindowsSystem32notepad.exe

This states that we are assigning the Alias Name “np” to the program Notepad.exe. Once the command is run, it outputs the verification of our assigning the alias to the program.

这表明我们正在将别名“ np”分配给程序Notepad.exe。 一旦命令运行,它将输出我们为程序分配别名的验证。

sshot-2010-01-01-05-08-32

Now we can type our new shortcut “np” in the PowerShell prompt, hit enter,

现在,我们可以在PowerShell提示符下键入新的快捷方式“ np” ,按Enter,

sshot-2010-01-01-05-09-50

and our program opens right up!

我们的程序马上打开!

sshot-2010-01-01-04-40-52

If we need to remove the alias shortcut in the future, we’ll just type:

如果将来需要删除别名快捷方式,则只需键入:

remove-item alias:np

删除项目别名:np

sshot-2010-01-01-05-12-13

If you need your alias to resist deletion, then you can add one of two available options to the end of the alias creation command:

如果需要别名来阻止删除,则可以在别名创建命令的末尾添加两个可用选项之一:

This option will allow you to change the association of the alias or delete it during the session, but you will have to add -force to the end of the command.

此选项将允许您更改别名的关联或在会话期间将其删除,但是您必须在命令末尾添加-force

new-item alias:np -value C:WindowsSystem32notepad.exe –options “ReadOnly”

新项目别名:np -value C:WindowsSystem32notepad.exe –选项“只读”

This option will make the alias unable to be altered or deleted while the session is open.

此选项将使在打开会话时无法更改或删除别名。

new-item alias:np -value C:WindowsSystem32notepad.exe –options “Constant”

新项目别名:np -value C:WindowsSystem32notepad.exe –选项“常量”

To view all the current aliases, type:

要查看所有当前别名,请键入:

Set-Location alias: Get-ChildItem *

设置位置别名:Get-ChildItem *

sshot-2010-01-01-05-33-51

Creating shortcuts using aliases is pretty easy, and can be very useful. However, the alias definition will be removed the next time you open a PowerShell session, so if you want to make an alias permanent, you’ll have to modify your PowerShell Profile.

使用别名创建快捷方式非常容易,并且非常有用。 但是,下次打开PowerShell会话时,别名定义将被删除,因此,如果要使别名永久化,则必须修改PowerShell配置文件。

翻译自:

powershell快捷键

转载地址:http://sxywd.baihongyu.com/

你可能感兴趣的文章
hdu4348 - To the moon 可持久化线段树 区间修改 离线处理
查看>>
线性表的应用
查看>>
Asp.net网站的简单发布
查看>>
JAVA中enum的常见用法
查看>>
查找后去掉EditTextView的焦点
查看>>
springMVC中一个class中的多个方法
查看>>
Linux系统安装出错后出现grub rescue的修复方法
查看>>
线段树模板整理
查看>>
[教程][6月4日更新]VMware 8.02虚拟机安装MAC lion 10.7.3教程 附送原版提取镜像InstallESD.iso!...
查看>>
Guava之FluentIterable使用示例
查看>>
[iOS问题归总]iPhone上传项目遇到的问题
查看>>
软件包管理:rpm命令管理-包命名与依赖性
查看>>
iOS之瀑布流布局设计
查看>>
eclipse---常用快捷键
查看>>
位置服务成为新经济亮点
查看>>
Python天天美味(总) --转
查看>>
Spring Framework tutorial
查看>>
【VS开发】win7下让程序默认以管理员身份运行
查看>>
【机器学习】Learning to Rank 简介
查看>>
Unity 使用实体类
查看>>