The problem:I am getting nothing in return for the tempname() function in Vim. More specifically, I kept getting only .do assigned to the variable temp using the following statement. let temp = tempname() . .doThe complete function that fails to get itself a temp name:let selectedLines = getbufline('%', line('<), line('>))if col('>) < strlen(getline(line('>)))    let selectedLines[-1] = strpart(selectedLines[-1], 0, col('>))endifif col('<) != 1    let selectedLines[0] = strpart(selectedLines[0], col('<)-1)endiflet temp = tempname() . .docall writefile(selectedLines, temp) *** CHANGE PATH AND NAME TO REFLECT YOUR SETUP. USE \\ INSTEAD OF \ ***exec !start C:\\Vim\\vimfiles\\ftplugin\\Stata-Vim-Suite\\rundo.exe  . temp Delete the temp file after Vim closesau VimLeave * exe !del -y temp(The above codeblock is supposed to be the body of function define withfun! RunDoLines() on line-1, and endfun on the last line.RemarkThis functions has been running very well for years, and it was only today that it should have failed on both of my Windows machines. (I use this function to send commands from Vim to the terminal of a statistical software.)Things that I tried, but did not workI followed the instruction on the this page (vim.wikia), but tempname() still gets me an empty string. Related problemsAdditionally, here goes the error message I get when trying to run PlugInstall through Vim-Plug. I think this should also be related with my setting for the TEMP files.Minimal replication case:Issuing the following set of commands does not get me any output.:let temp_file = tempname():echo temp_fileHere goes a screenrecord demonstrating the problem:
How to fix the tempname() function on Windows 10?
vimscript;gvim;microsoft windows