I need help on opening a file on the computer

I want to click a button and it will open a program in the Start Menu then it opens All Programs and then it will open a file in the all programs folder

Answer this question

I need help on opening a file on the computer

  • programmer01

    well why dont you just get a path to the file and open that is this what you want to do or do you want to see it actually pressing the start menu > all programs and clicking the file

    to spin up a process (run an application for example) within your app, you would use the Process class in the System.Diagnostics namespace:

    System.Diagnostics.Process.Start("path\filename.exe")

    and thats it.



  • vahdam_mn

    interesting. you could do this however again you need to know the file name of the app

    System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Programs) & "\Video1")

    try that, see what happens.



  • Sergio.Rykov

    not sure I follow, are you able to explain a bit more clearer :-) in order to launch a file you would need to know its filename and path

  • ackermsb

    so is this your own application you want to run from within another app where is it installed though only shortcuts are placed in the startmenu to the actual file application stored somewhere on the computer.



  • PMMS

    oh ok the path to get to the VB.net application is Start<All Programs<Video1<VMKBrowser

    I right clicked on the file vmkbrowser and it does not have a target path it just shows me its location which is C:\Documents and Settings\Jared\Start Menu\Programs\Video1


  • EShepley

    ok the target is...  %SystemRoot%\System32\spider.exe        So what would be the code now, the program opens like this Start<All Programs<Games<SpiderSolitar
  • Ravi Kite

    yes, i need a path to open a file in the start menu by clicking a button, can you give me a code example like if i wanted to open spider solitar.

    I am using Windows XP


  • Nate00

    yes this is my own application and i am running it from another application i created. Although i cannot find the place where it is stored it looks like it is stored in the startmenu i know this is odd but when i look at its target it is the start menu
  • JerryMcR

    well you need to know the path and filename otherwise you can't really run the process. you can get the filename by right clicking on the shortcut and going to properties and seeing what the "target" property holds in the shortcut properties of that item in the start menu.

    you can get the path to the start menu no problem using the Environment.GetFolderPath(Enivornment.SpecialFolder.StartMenu)

    however you need to know the executable filename and its path.



  • CodeMann

    The start menu is nothing more than hierarchy of folders with shortcuts in them. Right click the start button and choose explore and you'll see.

    (You can then see if your app is actually installed there, which would be pretty silly if it was!)



  • yazad_gandhi

    I am no expert but I think this is the path

    C:\Documents and Settings\Jared\Start Menu\Programs\Video1\video1.exe



  • Robin E Davies

    to start the process of that path, simply do this:

     

    private sub cmdRunProgram_Click(byval sender as object, byval e as eventargs) handles cmdRunProgram.Click 'our button click event

     

       System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) & "\spider.exe")

     

    end sub

     

    and thats it. When clicked on the button, it will run that program. The Environment.GetFolderPath gets the path to the folder specified in the enum value, Environment.SpecialFolder.System, and then will add "\spider.exe" to the end of it so we give it the full path and file name of the program we want to launch



  • OmarSoto

    that worked great but what if i wanted to open a finished and published visual basic application, when i right click it there is no target path also i do not know it's value because it is not a .exe
  • I need help on opening a file on the computer