Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Open a file in Read format

Reply
 
Old 08-20-2008   #1 (permalink)
AdityaKir


 
 

Open a file in Read format

hi,

I am reading some data from a CSV file. Is there anyway we can open this
file only read only format ??

Thanks,

Aditya

My System SpecsSystem Spec
Old 08-20-2008   #2 (permalink)
Wes Stahler


 
 

Re: Open a file in Read format

On Aug 20, 5:47*pm, AdityaKir <Aditya...@xxxxxx>
wrote:
Quote:

> hi,
>
> I am reading some data from a CSV file. Is there anyway we can open this
> file only read only format ??
>
> Thanks,
>
> Aditya
Are you using import-csv?
My System SpecsSystem Spec
Old 08-20-2008   #3 (permalink)
AdityaKir


 
 

Re: Open a file in Read format

I am trying to read a csv file using import-csv . The thing is if the CSV
file is already opened. Then powershell cannot access the CSV file. Is there
any way to access the CSV file even if its already open

"Wes Stahler" wrote:
Quote:

> On Aug 20, 5:47 pm, AdityaKir <Aditya...@xxxxxx>
> wrote:
Quote:

> > hi,
> >
> > I am reading some data from a CSV file. Is there anyway we can open this
> > file only read only format ??
> >
> > Thanks,
> >
> > Aditya
>
> Are you using import-csv?
>
My System SpecsSystem Spec
Old 08-20-2008   #4 (permalink)
Wes Stahler


 
 

Re: Open a file in Read format

On Aug 20, 6:45*pm, AdityaKir <Aditya...@xxxxxx>
wrote:
Quote:

> I am trying to read a csv file using import-csv . The thing is if the CSV
> file is already opened. Then powershell cannot access the CSV file. Is there
> any way to access the CSV file even if its already open
>
>
>
> "Wes Stahler" wrote:
Quote:

> > On Aug 20, 5:47 pm, AdityaKir <Aditya...@xxxxxx>
> > wrote:
Quote:

> > > hi,
>
Quote:
Quote:

> > > I am reading some data from a CSV file. Is there anyway we can open this
> > > file only read only format ??
>
Quote:
Quote:

> > > Thanks,
>
Quote:
Quote:

> > > Aditya
>
Quote:

> > Are you using import-csv?- Hide quoted text -
>
> - Show quoted text -
If it is locked by another process I don't think you will be able to
read it. You may be able to check for the lock first before you
attempt to read it.
See http://www.eggheadcafe.com/software/...--part-2..aspx
for an example.
My System SpecsSystem Spec
Old 08-21-2008   #5 (permalink)
Shay Levy [MVP]


 
 

Re: Open a file in Read format

Hello AdityaKir,

You can read the locked file content, pass its content to a temp file and
read it back using Import-Csv:

$file = [io.path]::GetTempFileName()
cat lockedFile.csv | out-file $file
import-csv $file



---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic

A> I am trying to read a csv file using import-csv . The thing is if the
A> CSV file is already opened. Then powershell cannot access the CSV
A> file. Is there any way to access the CSV file even if its already
A> open
A>
A> "Wes Stahler" wrote:
A>
Quote:
Quote:

>> On Aug 20, 5:47 pm, AdityaKir <Aditya...@xxxxxx>
>> wrote:
>>
Quote:

>>> hi,
>>>
>>> I am reading some data from a CSV file. Is there anyway we can open
>>> this file only read only format ??
>>>
>>> Thanks,
>>>
>>> Aditya
>>>
>> Are you using import-csv?
>>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Cannot open file attachment in PDF format Vista mail
in vb.net how to open a file from file download prompt without askinguser to save it or run it....just open it in internet explorer .NET General
How to Read a MS Word file in tabular format? VB Script
New Vista Community format hard to read Vista General
How to open a file for read/write access in Program Files directory Vista security


Vista Forums 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 Ltd

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