Home » Questions » Computers [ Ask a new question ]

Will an executable moved to another directory still work?

Will an executable moved to another directory still work?

I'd like to know if moving an executable to a directory different from where it is installed will make it not be able to work? I remembered it is the case under Windows XP when running the executable by clicking its icon. Under Linux terminal, it seems that with its path specified correctly, the executable can still work? Thanks for clarification! Regards!

Asked by: Guest | Views: 339
Total answers/comments: 3
Guest [Entry]

"As long as the executable can find it's dependencies (other dlls on Windows for example) then it will work. If it can't for any reason (i.e. it assumes that they are in the same directory) then it won't.

Unfortunately the error messages you get out of Windows aren't always the most helpful so you might have problems locating all the required files."
Guest [Entry]

"So here's the trick:

Go to C:\Users\\AppData\Local\
Delete IconCache.db
Kill explorer.exe from task manager
Again start explorer.exe

It will work, you will see your new icon when you copy/move next time."
Guest [Entry]

"Under Linux (and UNIX in general) most executables can be moved around freely. They usually find their dependencies automatically ... sometimes using ~/.* (""dot files"") ... conventionally named things like ~/.rc (where 'rc' originally stood for ""run command"" but can be thought of as ""resource/configuration"" settings). Sometimes (increasingly) UNIX/Linux packages will create a ~/. directory (such as ~/.gnome/, ~/.firefox/ and so on).

Commonly an application will check for a ~/.* file, then look for an /etc/ configuration file. It may search in other places (such as /opt/etc/ or /usr/local/etc).

It's also fairly common for such programs to honor an environment setting ... so you export (Bourne-family shells) or setenv (csh/tcsh) an appropriate setting setting for those. Of course it's also common for them to take a command line switch to point at any configuration files or resources.

Generally it's best to refer to a program's documentation to find out about the files and environment settings. Usually a program will allow a command line switch to over-ride any environment setting, over-riding any ~/.* setting, which over-rides any /etc/* setting which might over-ride any compiled in setting. However, that's merely a loosely followed convention. Check the docs!

In general UNIX/Linux programs are far less fragile than MS Windows or older MacOS programs in managing their resource locations. There's usually no opaque ""registry"" or ""resource forks"" to hide these things from you."