I have also encountered the same problems when invoke code . in cmd. And I found I have a symbolic code.exe -> C:/Users/Liu.D.H/AppData/Local/Programs/Microsoft VS Code/Code.exe, I removed it then it's ok now.
code .
code.exe
C:/Users/Liu.D.H/AppData/Local/Programs/Microsoft VS Code/Code.exe