Difference Between ./Executable and . Executable

What are the differences between a Program, an Executable, and a Process?

In simple words -

Program: Program is a set of instructions which is in human readable format.(HelloWorld.c)

Executable: Executable is a compiled form of a Program (HelloWorld.exe file)

Process: Process is the executable being run by OS. The one you see in Task Manager or Task List (HelloWord.exe Process when we double click it.)

What's the difference between binary and executable files mentioned in ndisasm's manual?

An object file contains machine language code, and all sorts of other information. It sounds like ndisasm wants just the machine code, not the other stuff. So the message is telling you to use the objdump utility to extract just the machine code segment(s) from the object file. Then you can presumably run ndisasm on that.

Difference between ./executable and . executable

is there a difference between ./executable and source executable?

basic difference is,

./foo.sh      - foo.sh will be executed in a sub-shell
source foo.sh - foo.sh will be executed in current shell

some example could help to explain the difference:

let's say we have foo.sh:

#!/bin/bash
VAR=100

source it:

$ source foo.sh 
$ echo $VAR
100

if you :

./foo.sh
$ echo $VAR
[empty]

another example, bar.sh

#!/bin/bash
echo "hello!"
exit 0

if you execute it like:

$ ./bar.sh
hello
$

but if you source it:

$ source bar.sh
<your terminal exits, because it was executed with current shell>

Difference between code object and executable file

Object files are source compiled into binary machine language, but they contain unresolved external references (such as printf,for instance). They may need to be linked against other object files, third party libraries and almost always against C/C++ runtime library.

In Unix, both object and exe files are the same COFF format. The only difference is that object files have unresolved external references, while a.out files don't.

Difference between .exe and .pe files?

Portable Executables (PE) are files that contain all the necessary information for the operating system to correctly load executable code (.exe, .dll, ...)

This may include dynamic library references for linking, resource management, TLS data, among other things.

Executables (.exe), however, are the files that denote the main execution point on a computer program, that is, speaking in C# terms, the file that contains the Main function or entry point.

Is .exe the only extension of executable program in Windows OS?

If you're talking about executing commands then all the extensions in the %PATHEXT% environment variable can be run without specifying the extension. For example *.bat, *.vbs... are all "executable" in that sense

> echo %pathext%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

If it's about binary executables then Windows doesn't care about the extension of executable files. It just checks the format and if it's a supported binary format then it'll be run. Modern Windows uses PE format which starts with the MZ magic number so if you create a *.TXT file with MZ at the beginning and run it in cmd then it'll actually be treated as an executable file. In fact many files in the System32 folder like *.SCR, *.CPL... are also PE files and still run when we double click on them. And even *.COM files in modern Windows apps are also PE files. The *.COM extension is only for differentiating with another *.EXE of the same app, but with priority in running because *.COM is put before *.EXE in %PATHEXT% by default as can be seen above:

  • What would be the reason for WinSCP using a ".com" instead of ".exe"?
  • Executables in Visual Studio: devenv.com/devenv.exe

Windows 10 wsl (not wsl-2) even supports running Linux ELF executables directly and they of course doesn't have any extension by default. Since wsl-2 the file is run inside the VM instead of directly under Windows kernel like in wsl

Depending on Windows version it may support many more executable formats. The complete list is

  • Raw binary instructions in old *.com format
  • NE *.exe format
  • PE *.exe format
  • MZ *.exe format
  • ELF format

And they don't depend on the extension either except for the raw *.COM file

difference between a windows 'program' and an executable file

For a program to show up in "add/remove programs", it needs to be installed. Typically, this is done through an installer that takes care of registering the program with windows and modifies the environment so that the program functions properly.
It may modify the registry to store user preferences for example...

When you have just an executable, it's not necessarily installed. It may be standalone.
Some programs don't absolutely need to be installed even if it's the canonical way to add a program in the Windows system. That's why it may work.
Another executable may fail because it relies on modifying the state of the system to work properly.

I hope it helps :)



Related Topics



Leave a reply



Submit