Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have cp for power shell. But I want to use cp in verbose mode without writing -v. So cp should be aliased to "cp -v" command. How to alias cp to "cp -v" in power shell?

share|improve this question
    
What are you really trying to do? –  kinokijuf Aug 28 '12 at 16:12
    
I have cp for power shell. But I want to use cp in verbose mode without writing -v. So cp should be aliased to "cp -v" command. –  Narek Aug 28 '12 at 16:18

3 Answers 3

up vote 2 down vote accepted

The alias command will not create parameters. You'll have to delete the existing alias for cp and use a function:

Remove-Item alias:cp
Function cp { Copy-Item -v @args }

See here.

share|improve this answer
    
THanks a lot!!!! –  Narek Aug 29 '12 at 11:49

Create a new alias for calling cp with the Verbose flag:

function Copy-ItemWithVerbose
{
    Copy-Item -Verbose @args 
}
Set-Alias -Name cpv -Value Copy-ItemWithVerbose
share|improve this answer

in PS3 you can use this:

PS III> $PSDefaultParameterValues.Add("Copy-item:verbose","$true")
PS III> cp
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.