Extracting files from an EXE

Discussion in 'ASP .Net' started by Zagor, Mar 18, 2006.

  1. Zagor

    Zagor Guest

    Hi All,
    I have a small exe app ( basic a dialog box) that when lauched needs to
    "copy" some files in a directory chosen by the user (within the dialog). I
    cannot use an installation package because there are some particular tasks
    to be done from the exe.
    Anyhow I was wondering if it possibile to include files within the (C#)exe
    and then extract them from the exe when launched...sort of an installation.
    I was thinking to add them as resources but I do not know how to extract
    them.

    Please any hint will be appreciated

    Thank you
    Zagor
     
    Zagor, Mar 18, 2006
    #1
    1. Advertisements

  2. Zagor

    SStory Guest

    There is Zip genius software.

    You can zip a file and then direct it unzip all files to a directory and
    then run an exe if it is named Setup.exe.

    That would get the files in a directory and then run your exe.

    Otherwise, this sounds a lot like a virus.


    "Zagor" <> wrote in message
    news:...
    > Hi All,
    > I have a small exe app ( basic a dialog box) that when lauched needs to
    > "copy" some files in a directory chosen by the user (within the dialog). I
    > cannot use an installation package because there are some particular tasks
    > to be done from the exe.
    > Anyhow I was wondering if it possibile to include files within the (C#)exe
    > and then extract them from the exe when launched...sort of an
    > installation.
    > I was thinking to add them as resources but I do not know how to extract
    > them.
    >
    > Please any hint will be appreciated
    >
    > Thank you
    > Zagor
    >
     
    SStory, Mar 28, 2006
    #2
    1. Advertisements

  3. Zagor

    VJ Guest

    Are you looking to extract the embbedded files from the exe to extract when
    your exe launches?.. If the answer is yes... then here is what you do... in
    your code at you can do this..

    string includeFileName = "MyApplication.MySapce.Trial.jpg";
    string strNewPathToSave = @"C:\MyNewPath\Trial.jpg";

    System.IO.Stream myFile
    = System.Reflection.Assembly.GetManifestResourceStream(includeFileName);

    if ( myFile== null )
    return "Unable to read the License file."; //"Inspherion License file is
    not valid. Please contact Inspherion Support";

    System.IO.FileStream fs = System.IO.File.OpenWrite(strNewPathToSave);
    try
    {
    // Save the File...
    byte[] buffer = new byte[myFile.Length];
    myFile.Read(buffer,0,(int)myFile.Length);
    fs.Write(buffer,0,buffer.Length);
    }
    finally
    {
    fs.Close();
    }

    Remeber that.. the includeFileName has to be fully qualified with Namespace
    used by the executable or assembly where the file is embbeded.

    HTH
    VJ

    "Zagor" <> wrote in message
    news:...
    > Hi All,
    > I have a small exe app ( basic a dialog box) that when lauched needs to
    > "copy" some files in a directory chosen by the user (within the dialog). I
    > cannot use an installation package because there are some particular tasks
    > to be done from the exe.
    > Anyhow I was wondering if it possibile to include files within the (C#)exe
    > and then extract them from the exe when launched...sort of an
    > installation.
    > I was thinking to add them as resources but I do not know how to extract
    > them.
    >
    > Please any hint will be appreciated
    >
    > Thank you
    > Zagor
    >
     
    VJ, Apr 16, 2006
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Namratha Shah \(Nasha\)
    Replies:
    0
    Views:
    4,876
    Namratha Shah \(Nasha\)
    Nov 5, 2004
  2. Chitra

    ASPnet_wp.exe and CSRSS.exe

    Chitra, Nov 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    498
    Chitra
    Nov 7, 2003
  3. Id L
    Replies:
    2
    Views:
    4,885
    mikeb
    Mar 3, 2004
  4. Dave
    Replies:
    1
    Views:
    465
    =?Utf-8?B?SGVybWl0IERhdmU=?=
    Jan 30, 2006
  5. Replies:
    4
    Views:
    460
    Andrew Thompson
    Dec 4, 2006
Loading...

Share This Page