473,396 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Where? run directory

On a windows system.
I'm trying to get a Mcmillian created program to be 'independent' but
the first thing I need to do is find out where the program is being
run from, not the shortcut but the generated exe. This is where I keep
all the set-up files that I need to access.
Currently I have a fixed directory but don?t want to write anything
into the registry.
Is there a reg setting though that gives the address of the last run
program (presumably my program) or something like a working directory
setting.
I don?t want to have to search for the program through the directory
structure as that would be very time consuming.

Any Ideas out there would be very welcome
Thanks
Jul 18 '05 #1
1 1291

"Adrian Smith" asks,
On a windows system.
I'm trying to get a Mcmillian created program to be 'independent' but
the first thing I need to do is find out where the program is being
run from, not the shortcut but the generated exe. This is where I keep
all the set-up files that I need to access.
Currently I have a fixed directory but don?t want to write anything
into the registry.
Is there a reg setting though that gives the address of the last run
program (presumably my program) or something like a working directory
setting.
I don?t want to have to search for the program through the directory
structure as that would be very time consuming.


I think you're looking for:

import os
print os.path.dirname(__file__)
HTH,

Emile van Sebille
em***@fenx.com
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: MLH | last post by:
I have a database named credifree. I did it with mysql's create command. Yet, I can find no files on my linux box except for a\ directory and a gif file that have the name credifree. Why? What's...
0
by: Sijmen | last post by:
In reference to the following post by Brandon Bray from Microsoft: http://groups.google.com/groups?q=g:thl1709599354d&dq=&hl=en&lr=&ie=UTF-8&selm=%238CXKwM3BHA.2488%40tkmsftngp04 Among other...
6
by: Peter Row | last post by:
Hi, Can someone give me a set of steps for an ASP.NET project (well actually its just a VB.NET class DLL that implements HttpHandler) that will work when moved to another developers machine? ...
7
by: Random | last post by:
I have created a couple of DLL's in .NET that I want to use in a couple of my web projects, that will be running on the same web server. Instead of thn using the'bin' directory, what is the...
10
by: vwd2005eeb | last post by:
Visual Web Developer 2005 Express Edition Beta I did Build | Build Web site, where are the DLLs? I was expecting to see maybe one dll for each Web page in a directory (maybe still "bin") under...
6
by: Lenn | last post by:
Hi, I have a DLL with unmanaged function written in C. I need to call from managed C# code, where should DLL have to placed, bin folder system32? And can this location be changed. I haven't...
10
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version....
24
by: Paul | last post by:
I am taking over an existing app and having trouble understanding their references. They have encapsulated Pear packages in the directory structure like: /site /site/html/Pear.php...
4
by: noobles | last post by:
I'm trying to make a command line parser, but I'm not exactly sure where to put my file.txt file so that this thing can read it. The most logical place seemed to be the directory the project was...
6
by: littlelisper | last post by:
I want to open an XML file with my browser. The file contains the following line: <?xml-stylesheet type="text/xsl" href="/new.xsl"?> which points to the root node to look for the stylesheet....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.