Program name: Difference between revisions
Content added Content deleted
(simplified) |
(→{{header|PowerBASIC}}: Added PureBasic) |
||
Line 658: | Line 658: | ||
Recent versions of PowerBASIC provide the <code>EXE</code> object; <code>EXE.NAME$</code> returns the program's name, while <code>EXE.NAMEX$</code> returns the program's name and extension. (<code>EXE.EXTN$</code> returns the extension only.) So, to get the program's name, we do this: |
Recent versions of PowerBASIC provide the <code>EXE</code> object; <code>EXE.NAME$</code> returns the program's name, while <code>EXE.NAMEX$</code> returns the program's name and extension. (<code>EXE.EXTN$</code> returns the extension only.) So, to get the program's name, we do this: |
||
<lang powerbasic>appname = EXE.NAMEX$</lang> |
<lang powerbasic>appname = EXE.NAMEX$</lang> |
||
=={{header|PureBasic}}== |
|||
PureBasic provides a way to retrieve the filename of the program being executed. It includes the file's path. |
|||
<lang PureBasic>If OpenConsole() |
|||
PrintN(ProgramFilename()) |
|||
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input() |
|||
CloseConsole() |
|||
EndIf</lang> |
|||
Sample output when executing the above program compiled to an executible file called 'program name.exe': |
|||
<pre>H:\Data\Rosetta Code\program name.exe</pre> |
|||
=={{header|Python}}== |
=={{header|Python}}== |