How to restart computer with PowerShell console open

Within PowerShell 2.0 running in Windows XP, I execute the following command:

Restart-Computer 

And get the following message:

Windows cannot end this program. It may need more time to complete an operation.

To return to Windows and check the status of the program, click Cancel.

If you choose to end the program immediately, you will lose any unsaved data. To end the program now, click End Now.

This happens whether I restart from PowerShell or from Windows itself. Any idea how I can restart a computer that will close a PowerShell console without prompt?

Replay

Use -Force to cause an immediate restart of the computer

One way is to use shutdown.exe with the -f parameter. Run shutdown /? from a cmd window for the full details.

Category: powershell Time: 2011-10-03 Views: 2
Tags: powershell

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.275 (s). 12 q(s)