- Tạo file profile
- Xem file profile đã có chưa
$ cat $profile
- Nếu chưa có thì tạo mới
'C:\Users\nddong\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'
-
add command vào file
function set-sshDat {ssh root@192.168.211.121}
Set-Alias -Name ssh_dat -Value set-sshDat <--dòng này không cần cũng được
-
Import file trên
$ Import-Module $profile
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_aliases?view=powershell-7.4#alternate-names-for-commands-with-parameters
$ cat $profile
'C:\Users\nddong\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'
add command vào file
function set-sshDat {ssh root@192.168.211.121}
Set-Alias -Name ssh_dat -Value set-sshDat <--dòng này không cần cũng được
Import file trên
$ Import-Module $profile
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_aliases?view=powershell-7.4#alternate-names-for-commands-with-parameters