PowerShell The term is not recognized as cmdlet function script file or operable program

You first have to ‘dot’ source the script, so for you : . .\Get-NetworkStatistics.ps1 The first ‘dot’ asks PowerShell to load the script file into your PowerShell environment, not to start it. You should also use set-ExecutionPolicy Unrestricted or set-ExecutionPolicy AllSigned see(the Execution Policy instructions).

PS1 line with Git current branch and colors

Here is, part by part (and no Ruby): function color_my_prompt { local __user_and_host=”\[\033[01;32m\]\u@\h” local __cur_location=”\[\033[01;34m\]\w” local __git_branch_color=”\[\033[31m\]” #local __git_branch=”\`ruby -e \”print (%x{git branch 2> /dev/null}.grep(/^\*/).first || ”).gsub(/^\* (.+)$/, ‘(\1) ‘)\”\`” local __git_branch=”`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`” local __prompt_tail=”\[\033[35m\]$” local __last_color=”\[\033[00m\]” export PS1=”$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color ” } … Read more

How can I set / change DNS using the command-prompt at windows 8

First, the network name is likely “Ethernet”, not “Local Area Connection”. To find out the name you can do this: netsh interface show interface Which will show the name under the “Interface Name” column (shown here in bold): Admin State State Type Interface Name ————————————————————————- Enabled Connected Dedicated Ethernet Now you can change the primary … Read more

Running command line commands within Ruby script

Yes. There are several ways: a. Use %x or ‘`’: %x(echo hi) #=> “hi\n” %x(echo hi >&2) #=> “” (prints ‘hi’ to stderr) `echo hi` #=> “hi\n” `echo hi >&2` #=> “” (prints ‘hi’ to stderr) These methods will return the stdout, and redirect stderr to the program’s. b. Use system: system ‘echo hi’ #=> … Read more

How can I display my current git branch name in my PowerShell prompt?

An easier way would be just installing the Powershell module posh-git. It comes out of the box with the desired prompt: The Prompt PowerShell generates its prompt by executing a prompt function, if one exists. posh-git defines such a function in profile.example.ps1 that outputs the current working directory followed by an abbreviated git status: C:\Users\Keith … Read more

How to zip a file using cmd line?

If you are using Ubuntu Linux: Install zip sudo apt-get install zip Zip your folder: zip -r {filename.zip} {foldername} If you are using Microsoft Windows: Windows does not come with a command-line zip program, despite Windows Explorer natively supporting Zip files since the Plus! pack for Windows 98. I recommend the open-source 7-Zip utility which … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)