How do you open a file from the root directory without have to type the complete path like C:\folder\subfolder\file.txt? I have


It works fine when I type in the whole location but I need to send this file to another computer and it won't be in the same folder as it is now probably. I've tried moving the file around in the project folder and even put it in the debug folder with the .exe file.

I'm also using this same code to open a .exe file and I don't have to type in the whole path to get that, just file.exe. That works fine.

If the above were an exe, you could rely on the computers path to pick it up if it were in say windows or system32 etc, such as notepad. However, you would need to know where the file was before you could start it. Either the computers current directory would have to be set to the directory in question, or you would need to put the full path in your start process command.

is there a different command to use to just open a text file?

Well, you could tell it specifically which app to open in, but as a general rule as long as the file extension is properly associated with an application eg, windows knows the equivelent of double click is to open it in something, it should trigger it.

Perhaps you could use the "Path" type like so Myfullpath = Path.GetFullPath(Myfile.txt) This should return something like 'C:\MyFolder\MySubFolder\Myfile.txt' in Myfullpath.

It would need to find "myfile.txt" to do that however.

I assumed "myfile" was in the current working directory...

Along with all the previous, you MUST know where the file will be, whether that is remote or local. If it is remote you can use a unc path like \\\shared\myfile.txt. A possibly better solution would be to use mapped network drives, and not necessarily hard code all these paths. If its on a remote machine you can access it like Z:\myfile.txt as long as Z is mapped to \\\shared\

kindly help me...........
i make the project in my lap top is off after whan we open the then this error show.......................
project file could not be loaded.root file is missing??
plz my help me what are u doing