As per the Emacs docs, every time you open a file, Emacs changes default-directory to the directory containing that file.
default-directory
Then, if the cursor is in th
You could try using something like this:
(add-hook 'find-file-hook (lambda () (setq default-directory command-line-default-directory)))