Windows PowerShell is a command line shell and scripting language for Windows that supersedes the CMD.exe shell and batch language. PowerShell is also an automation engine for Windows that provides functionality similar to Windows Script Host and VBScript.

learn more… | top users | synonyms

164
votes
7answers
155k views

Native alternative to wget in Windows PowerShell?

I know I can download and install the aformentioned library (wget for Windows), but my question is this: In Windows PowerShell, is there a native alternative to wget? I need wget simply to retrieve ...
19
votes
2answers
21k views

Programatically associate file extensions with application on Windows

I've just recently reinstalled Windows and in setting up my environment I've noticed that all my associations for the various programming languages I edit in Notepad++ have gone (naturally). I am ...
24
votes
7answers
28k views

How to enable Internet Connection Sharing using command line?

I can do it manually by right-clicking on a network connection, opening the Sharing tab and clicking on the "Allow other network users to connect through this computer's Internet connection" check box....
15
votes
10answers
27k views

Bulk convert photos to smaller size? [closed]

I have about 500 photos - each about 5MB in size. I'd like to bulk convert them to a smaller size, suitable for email and web-hosting. Tools at my disposal - Windows 7 Powershell 2 A free tool I ...
28
votes
3answers
12k views

What is Windows' equivalent of the “which” command in Unix? Is there an equivalent PowerShell command?

In Linux, we have the "which" command to find out the path of an executable. What is its Windows equivalent? Is there any PowerShell command for doing that?
38
votes
5answers
103k views

how to run a powershell script as administrator

On my Windows 7 Desktop, I have script.ps1, which needs admin privileges (it starts a service). I want to click on this script and run it with admin privileges. What's the easiest way to ...
36
votes
9answers
16k views

Cannot change powershell default font to Lucida Console

This is a trivial problem, but it annoys me that I can't get to the bottom of it: I'm running Windows 8, Powershell version 3.0. By right-clicking on the title bar I can go into the Properties and ...
8
votes
2answers
13k views

Is there a ln symlink command in Windows 7 [duplicate]

Possible Duplicate: Does window have the ln -s or equivalent? Is there an equivalent ln command to create symlinks in Windows?
5
votes
7answers
28k views

How can I permanently assign drive letters to my USB devices in Windows?

I have several customers with different PCs (Windows XP, Windows Vista and Windows 7). Unlike DOS 6.22, where you can permanently assign drive letter designations (e.g. Drive C: = Hard Disk Bootable ...
5
votes
4answers
6k views

How can I delete a folder with “illegal” characters?

I plugged my USB flash memory stick into a Mac and it gained some unwanted hidden folders. (See the question Prevent MacOS from making .* and ._* files for prevention.) I'd now like to remove these ...
3
votes
4answers
7k views

Change directory in batch file with PowerShell

I need to changed directory using batch file in PowerShell. Let's say the batch file named go.bat has the two lines of code. And I'm in q: directory. c: cd c:\abc\def When I run go.bat, I'm ...
113
votes
4answers
357k views

How to enable execution of PowerShell scripts?

When I try to execute my PowerShell script I get this error: File C:\Common\Scripts\hello.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help ...
45
votes
4answers
22k views

Turning off the cmd window beep sound

Is there a way to essentially mute the Beeping function of the Windows command shell? I'm working on a PowerShell script right now which ends up printing several lines of text to the screen. I'm ...
22
votes
2answers
24k views

How can I mount an ISO via PowerShell/programmatically?

How can I mount and dismount ISO images from PowerShell in Windows 8 without 3rd party programs? This question's original revision got me wondering if it's possible to mount an ISO via PowerShell in ...
22
votes
2answers
14k views

Default PowerShell to emitting UTF-8 instead of UTF-16?

By default, PowerShell in Windows seems to be outputting UTF-16 (e.g., if I do a simple echo hello > hi.txt, then hi.txt ends up in UTF-16). I know that I can force this to my desired text ...
10
votes
4answers
2k views

How to embed PowerShell into Explorer or Explorer-like tool?

I typically find myself using both Windows Explorer (for navigation and viewing) and PowerShell (for commands). Is there any way to embed the PowerShell console into Windows Explorer? Or is there any ...
9
votes
3answers
5k views

Can PowerShell be used within the Windows Recovery Environment?

I have tried to access PowerShell from the Command Prompt in Windows Recovery Environment with no success. I am able to run VBScripts there without a problem, and I am now wondering if there is some ...
22
votes
3answers
6k views

How do I modify the Powershell console settings in Windows 7?

I go to properties and change the font and buffer size, and when I press okay, I get: Unable to modify the shortcut. I checked to make sure it has not been deleted or renamed.
1
vote
1answer
2k views

Install Windows Store App itself

I used to deinstall, when I set up a new Windows 8 installation, every App via Powershell by this command: Get-AppxPackage | Remove-AppxPackage It removed any Apps except some very basic ones e.g. ...
8
votes
5answers
11k views

How to do a Powershell (or other) script to change screen resolution?

How can I script a screen resolution change, for example to 1024*768?
7
votes
4answers
24k views

How to re-install Windows 10 calculator app

I uninstalled the calculator like this in PowerShell: Get-AppxPackage *windowscalculator* | Remove-AppxPackage. How do I reinstall it? Many thanks in advance.
5
votes
5answers
7k views

How do I set the Powershell default font to Consolas?

I would like to have the Consolas font set as default for Powershell on Windows 7, no matter how I launch it. I've found very few explanations on the web for doing this, and none were really clear to ...
2
votes
1answer
696 views

How to use Powershell Remote across the internet?

I know that Powershell can be used on local network. But what if the computer that I want to manage is not on the same Lan as mine? We are each on a seperate LAN and both are behind a firewall. How ...
1
vote
1answer
389 views

Unable to SSH to my virtual machine via Windows Power Shell ISE

I have a Linux VM guest running in my vmWare host that I want to access using Windows PowerShell ISE. I normally can SSH to my VM, but I cannot with Windows PowerShell ISE. When I try to do SSH to my ...
1
vote
1answer
261 views

More than one 'Open xxxxx here as Administrator'

I want the option to open a Command window or Powershell window as Administrator from the drive and directory context menus in Windows. I can have either by creating and populating the special '...
3
votes
2answers
4k views

Keep outlook 2010 open [duplicate]

Possible Duplicate: How to make Outlook 2010 minimize when I try to close it? I want to "disable" the ability to close Outlook2010. I always "close" it instead of minimizing it. What are some ...
3
votes
1answer
87 views

Getting SID from win32_groupuser

I am trying to get the SIDs of users and groups by querying get-wmiobject -query 'select groupcomponent,partcomponent from win32_groupuser` output: __GENUS : 2 __CLASS : ...
2
votes
1answer
3k views

How do I leverage Bitlocker cmdlets?

This article hints at being able to unlock a bitlocked drive using: Unlock-BitLocker -MountPoint -Password However, I know diddly squat about Powershell and how to use the Powershell cmdlets to do ...
1
vote
2answers
502 views

Opening PowerShell at the current working directory from the registry

This question is prompted by a problem I faced while writing this answer. I am invoking PowerShell like this from the registry: C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit -...
1
vote
2answers
1k views

Batch create folders?

I'm looking for a way to batch create a folder followed by sub-folders. I'm looking at something like c:\users\user\desktop\sample\1 c:\users\user\desktop\sample\2 etc. Any ideas? I'd prefer ....
0
votes
1answer
554 views

How do I renaming files in a batch with a counter?

I have 14,000 picture sorted into files by year and month but taken with multiple cameras. I want the file name to reflect the date the photo was taken. For example, all pictures taken on October 16,...
-1
votes
1answer
124 views

How to set up Windows on VM using Powershell (Hyper-V)

I know how to create a VM and I know how to start that VM on Hyper-V using the script of Powershell but it's the first use of the VM so I need to set up Windows and I don't know how using the ...
68
votes
11answers
55k views

Equivalent of Linux `touch` to create an empty file with PowerShell?

In PowerShell is there an equivalent of touch? For instance in Linux I can create a new empty file by invoking: touch filename On Windows this is pretty awkward -- usually I just open a new ...
24
votes
8answers
33k views

Linux “Top” command for Windows Powershell?

I am looking for a PowerShell cmdlet that can provide similar functionality to the Linux Top app. Something that refreshes at some given interval and displays the process list with CPU % util. I have ...
24
votes
7answers
69k views

Delete all files from a folder and its sub folders

I want to remove all files from a folder structure, so I'm left with an empty folder structure. Can this be achieved in either batch or VBScript scripting? I have tried a very basic batch command, ...
77
votes
2answers
85k views

How do I run multiple commands on one line in Powershell?

In cmd prompt, you can run two commands on one line like so: ipconfig /release & ipconfig /renew When I run this command in PowerShell, I get: Ampersand not allowed. The & operator is ...
24
votes
3answers
15k views

Powershell equivalent of `grep -r -l` (--files-with-matches)

In Powershell, how do I list all files in a directory (recursively) that contain text that matches a given regex? The files in question contain really long lines of incomprehensible text, so I don't ...
12
votes
3answers
2k views

PowerShell: history enhancements (readline)?

Some of the things I like in Bash and would love to know how to do in PowerShell: In Bash, I have history scrolling set up so that it only scrolls commands that begin with the same prefix as the ...
11
votes
2answers
5k views

Configure the Windows Powershell to display only the current folder name in the shell prompt

I'm using Powershell in Windows 7. How to configure Powershell so that it only displays the current folder name (instead of the full path) in the shell prompt? For example, Instead of C:\folder\...
10
votes
4answers
3k views

What are the PowerShell consoles for Windows?

Linux is known for having lots of terminals and consoles that are built upon GTK, Qt, GNOME, KDE or X to run the shell (like bash). PowerShell on Windows runs with the Windows console (the same as ...
19
votes
7answers
25k views

Powershell font wrong size on Windows 8.1

On my Windows 8.1 machine, I need powershell to configure office web apps. When I start powershell, for a blink of a second, it shows as it should, but then it gets resized, and the font becomes ...
17
votes
12answers
23k views

Is there a better, more UNIX-like command line shell for Windows?

I'm sure this has been asked before, but I haven't found it after an hour or so of searching... I've been using Unix and Mac OS for a while, but I'm a Windows user at heart. This #1 things that I've ...
16
votes
3answers
8k views

Is PowerShell a complete replacement for console/cmd?

Right now I'm using the Windows console (cmd.exe) for some easy tasks (as checking my ip configuration or running some applications). But now I heard that there is PowerShell which actually is way ...
13
votes
4answers
16k views

Keyboard shortcut to paste in Windows command prompt

Is there a keyboard shortcut to paste in the Windows command prompt (or at least powershell)? I'm aware that you can right click, but it would be handy if it was possible without touching the mouse.
8
votes
1answer
4k views

Equivalent of bash's `source` command in Powershell?

To run a bash script line-by-line (so as to preserve environment variables, for instance), one does the following: $ . myscript.sh Or: $ source myscript.sh I have a PowerShell script that - ...
2
votes
1answer
2k views

Windows Powershell: Executing commands via the context menu?

I'm using kramdown to convert my markdown-formatted source files into html. The command I've been using is: kramdown %filename | Out-Clipboard (Out-Clipboard is from the fantastic PSCX. This means ...
34
votes
4answers
11k views

Powershell equivalent to unix `which` command?

Does powershell have an equivalent to the which command found in most (if not all) unix shells? There are a number of times I'd like to know the location of something I'm running from the command ...
15
votes
4answers
17k views

Show human-readable file sizes in the default PowerShell ls command

How can I modify the default ls (Get-ChildItem) in PowerShell so that it displays human-readable file sizes, like ls -h on a *nix machine? ls -lh does simple logic with the file size, so that it ...
9
votes
5answers
26k views

How to rename multiple files in multiple folders with one command

We want to rename our *.html files to *.php but (sadly enough) have not enough knowledge to do it with a cmd prompt command and/or batch file. The problem is that each file is in separate folder – ...
7
votes
2answers
6k views

PowerShell zip file synchronously

In a PowerShell script, I want to zip a folder before deleting the folder. I run the following (I don't remember where I found the snippet): function Compress-ToZip { param([string]$zipfilename) ...