Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Out-File -Force doesn't seem to work as advertised

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-11-2007   #1 (permalink)
Clint Bergman
Guest


 

Out-File -Force doesn't seem to work as advertised

I'm having a bit of trouble with Out-File, from Get-Help Out-File -detailed:

-force <SwitchParameter>
Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security
. For example, Force will override the read-only attribute or create directories to complete a file path, but i
t will not attempt to change file permissions.

However:

PS C:\temp> out-file -FilePath .\foo\bar.txt -InputObject "String" -Force
Out-File : Could not find a part of the path 'C:\temp\foo\bar.txt'.
At line:1 char:9
+ out-file <<<< -FilePath .\foo\bar.txt -InputObject "String" -Force

Am I doing something wrong, or is this something I should submit to connect?

^_^ ~Clint

My System SpecsSystem Spec
Old 05-11-2007   #2 (permalink)
Don Jones [MVP]
Guest


 

Re: Out-File -Force doesn't seem to work as advertised

Looks like either a bug or something they intended to do, documented, and didn't get to . Take yer pick. But you're right, it won't create the path for you.

--
Don Jones
Windows PowerShell MVP
Founder: www.ScriptingAnswers.com
Co-Author: "Windows PowerShell: TFM"

"Clint Bergman" <clint@psd267.wednet.edu> wrote in message news:O4bqp9%23kHHA.1624@TK2MSFTNGP06.phx.gbl...
I'm having a bit of trouble with Out-File, from Get-Help Out-File -detailed:

-force <SwitchParameter>
Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security
. For example, Force will override the read-only attribute or create directories to complete a file path, but i
t will not attempt to change file permissions.

However:

PS C:\temp> out-file -FilePath .\foo\bar.txt -InputObject "String" -Force
Out-File : Could not find a part of the path 'C:\temp\foo\bar.txt'.
At line:1 char:9
+ out-file <<<< -FilePath .\foo\bar.txt -InputObject "String" -Force

Am I doing something wrong, or is this something I should submit to connect?

^_^ ~Clint
My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Advertised Shortcuts in a setup and deployment project Pat .NET General 3 03-27-2008 02:37 PM
Force Vista Downloads to ask me where to store the file HFL Vista General 5 12-19-2007 01:04 AM
Multi-boot setup process does not work as advertised in FAQs Aymincendiary Vista installation & setup 5 08-27-2007 07:47 AM
Should Get-Item . [-Force] always work? Roman Kuzmin PowerShell 1 04-06-2007 04:48 AM
Cyborg 3d force and Microsfts don't work John Vista General 0 02-24-2007 07:57 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51