views:

117

answers:

3

Hi

We have a requirement to copy a .txt file into the client machine and open the file using notepad.exe.

We develop our application using MS Visual Studio 2008 VB .Net.

Any experencied this kind of requirement?

Help required...

Thanks Shoba Anandhan

A: 

This seems like a job for Powershell or Batch, not VB.NET

  copy foo.txt .
  notepad foo.txt
James Deville
A: 

You can use an MSI with the .txt file... and a custom action that opens the file after the installation is done. If the client machine is in the same network, try Powershell (remoting services).

Nestor
A: 

How about something like this:

    Dim FileToCopy As String
    Dim NewCopy As String
    FileToCopy = "\\SERVER-NAME\c$\file.txt"
    NewCopy = "c:\file.txt"
    If System.IO.File.Exists(FileToCopy) = True Then
        System.IO.File.Copy(FileToCopy, NewCopy, True)
    End If
    Shell("notepad.exe " & NewCopy, AppWinStyle.NormalFocus, False, -1)

If you put that code in the form closing event it will copy the text file from the server to the client and open it in notepad.

You might want to change the new copy location to a better choice - something they will definately have permission to.

Blind Trevor