Finally, I realized part of function that I want, though not satisfactorily.
I found that a pdf file in a temp folder is updated very time I pdflatex. Say, C:\Users\XXX\AppData\Local\Temp\lyx_tmpdir.Hp2836\lyx_tmpbuf2. Every time pdflatex open the viewer, it opens the this file. Thus the viewer for pdflatex is defined as SumatraView.bat, which is start "" /D "%~dp1" /B "SumatraPDF.exe" -reuse-instance -inverse- search "lyxeditor.exe %%f %%l" %~nx1 copy %~1 D:\Dropbox\PDFs /Y The first line are openning the pdfviewer and passing inverse search parameters. The second copies the file from the temporary folder to the Dropbox folder. Everytime I pdflatex, the PDF is copied to the specified folder. However, there is one more thing I would like to do: instead of putting it in a specific folder, I have the PDF file be put in the same folder as the lyx file is. I have checked that when pdflated run the pdf viewer, only the path of the temporary file is passed to SumatraView.bat. Anyone have any suggestions on how to get the path of the lyx file? Thanks in advance! Best, Xi