Find executed from path?

Windows specific forum
stmdbe2019
User
User
Posts: 89
Joined: Mon Aug 31, 2009 2:11 pm

Find executed from path?

Post by stmdbe2019 »

For example, User downloaded the PB EXE in C:\username\Download\ on execute how to get the path from where PB EXE was executed from?
-----
Registered PureBasic Coder.
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: Find executed from path?

Post by oO0XX0Oo »

Code: Select all

path.s = GetPathPart(ProgramFilename())
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: Find executed from path?

Post by cas »

User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: Find executed from path?

Post by Bisonte »

cas wrote:Also check GetCurrentDirectory().
not really... The current directory is set by windows or the user, and can be totally different !

To find out the path from the executed exe, oO0XX0Oo ' s way is the one and only way (on windows os) !
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: Find executed from path?

Post by cas »

Yeah, my post was just a suggestion for checking another command that by default returns the same thing. He did not say what exactly he needs this path for so there is a possibility that GetCurrentDirectory() will serve him better for his specific needs.
Post Reply