首页 > 系统相关 >PowerShell配置文件只Profile.ps1

PowerShell配置文件只Profile.ps1

时间:2023-12-16 10:32:51浏览次数:36  
标签:Profile function set 配置文件 item get alias location ps1

PowerShell执行的时候,首先会执行Profile.ps1的内容,如果我们想要执行PowerShell的时候,会获得某些功能,可以将想要的内容放到Profile.ps1中。这个文件默认存放在C:\Windows\system32\WindowsPowerShell\v1.0\Examples\下。该文件默认添加所有的别名,还有部分Function。内容如下:

#  Copyright (c) Microsoft Corporation.  All rights reserved.
#  
# THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
# IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF USE OR RESULTS IN
# CONNECTION WITH THE USE OF THIS CODE AND INFORMATION REMAINS WITH THE USER. 



set-alias cat        get-content
set-alias cd         set-location
set-alias clear      clear-host
set-alias cp         copy-item
set-alias h          get-history
set-alias history    get-history
set-alias kill       stop-process
set-alias lp         out-printer
set-alias ls         get-childitem
set-alias mount      new-mshdrive
set-alias mv         move-item
set-alias popd       pop-location
set-alias ps         get-process
set-alias pushd      push-location
set-alias pwd        get-location
set-alias r          invoke-history
set-alias rm         remove-item
set-alias rmdir      remove-item
set-alias echo       write-output

set-alias cls        clear-host
set-alias chdir      set-location
set-alias copy       copy-item
set-alias del        remove-item
set-alias dir        get-childitem
set-alias erase      remove-item
set-alias move       move-item
set-alias rd         remove-item
set-alias ren        rename-item
set-alias set        set-variable
set-alias type       get-content

function help
{
    get-help $args[0] | out-host -paging
}

function man
{
    get-help $args[0] | out-host -paging
}

function mkdir
{
    new-item -type directory -path $args
}

function md
{
    new-item -type directory -path $args
}

function prompt
{
    "PS " + $(get-location) + "> "
}

& {
    for ($i = 0; $i -lt 26; $i++) 
    { 
        $funcname = ([System.Char]($i+65)) + ':'
        $str = "function global:$funcname { set-location $funcname } " 
        invoke-expression $str 
    }
}












# SIG # Begin signature block

从88行开始的是注册证书内容。注册证书内容块被我删除。

标签:Profile,function,set,配置文件,item,get,alias,location,ps1
From: https://blog.51cto.com/u_3353175/8850071

相关文章

  • SAAS Product Edition | Profile
    *[AdobeCreativeCloud常见问题解答|中国](https://helpx.adobe.com/cn/creative-cloud/faq-china.html)Adobe为个人、公司和企业提供不同计划:对于个人而言,CreativeCloud摄影计划是目前在中国推出的唯一一项计划。对于中小型企业而言,我们提供CreativeCloud团队版。......
  • spring xml配置文件之context:annotation-config
    我们一般在含有Spring的项目中,可能会看到配置项中包含这个配置节点context:annotation-config。<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-......
  • tmux配置文件.tmux.conf (tmux 3.0a)
    本文是基于tmux3.0a进行的配置,使用tmux-V可查看版本下面是配置文件内容,在家目录下创建.tmux.conf,并粘贴下面内容保存后,进入tmux,ctrl+b,然后输入命令:source-file~/.tmux.conf即可(或在bash下执行tmuxsource~/.tmux.conf)。因为下面的命令中,bind了r作为source-file~/.tmu......
  • 记录ArcGIS Server Manager服务的网站配置文件泄露漏洞
    描述此漏洞在ArcGISServer10.2forWindows上被发现,在启用了ArcGISServerManager服务时,通过GET请求[主机+端口]/arcgis/manager/3370/js/../WEB-INT/web.xml地址,任意用户可获取ArcGIS的manager应用服务配置。风险等级:低(被泄露的文件对所有此产品用户可见,不包含机密信息)分......
  • apache 项目的php配置文件
    <VirtualHost*:80>[email protected]"/www/wwwroot/api.com"ServerNameapi.comServerAliasapi.com#errorDocument404/404.htmlErrorLog"/www/wwwlogs/api.com-error_log"Cu......
  • 二、Ansible配置文件
    二、Ansible配置文件2.1配置文件详解[defaults]:通用配置项[inventory]:与主机清单相关的配置项[privilegeescalation]:特权升级相关的配置项[paramikoconnection]:与paramiko相关的配置项,rhel6以前默认的ssh方式[sshconnection]:与ssh相关的配置项,rhel6以后默认的......
  • k8s配置文件管理
    1.为什么要用configMapConfigMap是一种用于存储应用所需配置信息的资源类型,用于保存配置数据的键值对,可以用来保存单个属性,也可以用来保存配置文件。通过ConfigMap可以方便的做到配置解耦,使得不同环境有不同的配置。考虑真实的使用场景,像数据库这类中间件,是作为公共资源,为多个......
  • nginx upstream配置文件
    1.upstream使用upstream指定服务器组进行负载均衡userroot;worker_processes20;error_loglogs/error;pidlogs/nginx.pid;events{worker_connections1024;}http{log_formatmain'$remote_addr-$remote_user[$time_local]"$request"......
  • Spring Boot学习随笔- @SpringBootApplication详解、加载绝对路径配置文件、工厂创建
    学习视频:【编程不良人】2021年SpringBoot最新最全教程3.5@SpringBootApplication详解这是一个组合注解,就是由多个注解组成。下列注解红框内称为元注解(jdk提供)@Target:指定注解作用范围@Retention:指定注解什么时候生效重要注解@SpringBootConfiguration:自动配置Spring......
  • 内核维护者手册 - 维护者入口配置文件【ChatGPT】
    https://www.kernel.org/doc/html/v6.6/maintainer/maintainer-entry-profile.html维护者入口配置文件维护者入口配置文件是对顶层流程文档(提交补丁、提交驱动程序等)的补充,其中包括子系统/设备驱动程序本地习俗以及有关补丁提交生命周期的详细信息。贡献者使用此文档来调整他......