On windows there are some problems one of them is that: fnmodify(path, ':p:8') return the part of the path that already exists.
i.e.
if C:\Users\Public\vim_temp_15128.txt does not exist but C:\Users\Public does then: fnmodify('C:\Users\Public\vim_temp_15128.txt', ':p:8') returns C:\Users\Public.
I suppose you are using the 8.3 format to avoid space in the path and to avoid the quote problem in the runas syntax:
runas /noprofile /user:MT-BRU-2-0102\ladmin "C:\Windows\system32\cmd.exe /k copy /Y C:\Users\Public\vim_temp_9676.txt C:\Users\vds\Desktop\hosts"
Maybe the alternative syntax is a fit that doesn't requiers the 8.3 syntax.
runas /noprofile /user:MT-BRU-2-0102\ladmin "C:\Windows\system32\cmd.exe /k copy /Y \"C:\Users\Public\vim_temp_9676.txt\" \"C:\Users\vds\Desktop\hosts\""
I'll create a Pull Request to proposes my changes.
Remark:
To convert to the 8.3 syntax you need to know what are the files in the directory.
Suppose you have in the folder the files:
abcdefgh1.txt
abcdefgh2.txt
abcdefgh3.txt
Convert abcdefg3.txt in 8.3 will depend of the presence of abcdefg1.txt.
Actually I believe the 8.3 name is created when the file is created in the folder or moved into the folder.
On windows there are some problems one of them is that: fnmodify(path, ':p:8') return the part of the path that already exists.
i.e.
if
C:\Users\Public\vim_temp_15128.txtdoes not exist butC:\Users\Publicdoes then:fnmodify('C:\Users\Public\vim_temp_15128.txt', ':p:8')returnsC:\Users\Public.I suppose you are using the 8.3 format to avoid space in the path and to avoid the quote problem in the runas syntax:
Maybe the alternative syntax is a fit that doesn't requiers the 8.3 syntax.
I'll create a Pull Request to proposes my changes.
Remark:
To convert to the 8.3 syntax you need to know what are the files in the directory.
Suppose you have in the folder the files:
abcdefgh1.txtabcdefgh2.txtabcdefgh3.txtConvert
abcdefg3.txtin 8.3 will depend of the presence ofabcdefg1.txt.Actually I believe the 8.3 name is created when the file is created in the folder or moved into the folder.