# autoexec.bat for user



## balanga (Feb 10, 2018)

How do I run a specific program for a given user when he has logged on?


----------



## chrbr (Feb 10, 2018)

I do not know by heart if there is one specific in the users home directory which is called independently of the login shell. I am quite sure you fill find ~/.profile or ~/.login or others which call fortune(6) by default. You can do similar things to achieve your specific goals.


----------



## ralphbsz (Feb 11, 2018)

Depends on the shell.  You need to read the man pages of the shell you use; in bash it is .profile and/or .bashrc and/or .bash_login, and it tcsh it is .cshrc and/or .tcshrc and/or .login.  Note that these files are not all equivalent, and are executed in different situations.  Look at the documentation.

When playing with these files: make sure you have another login that allows you to regain access to the machine if you screw up; if you have a terrible error in these files, it might become impossible to log in.  Also make sure that the commands that are used for non-interactive shells are very fast and don't create unnecessary output.


----------



## aragats (Feb 11, 2018)

There are too many variables: "invisible" program or a GUI app, executed once or at every terminal the user log in, whether the program keeps running in the background or performs a short action, etc. You should consider all possible consequences.


----------



## Deleted member 9563 (Feb 11, 2018)

balanga said:


> How do I run a specific program for a given user when he has logged on?


The question is good, but does doing that really serve much purpose? Seems to me you can just put an icon on the desktop and the user can click that. This looks especially good if there are no other icons on the desktop.


----------

