I am running a Lua program on a Windows 10 machine. This Windows 10 computer is networked to another Windows 10 computer and this other computer is sharing its D: drive with my computer. The shared drive is called the O: drive by my computer.
When I open a cmd window on my computer and type:
type "O:\Data\config\file.xml"
I get the contents of file.xml in my cmd window. However, if I run this same command through Lua:
f = io.popen([["type O:\Data\config\file.xml"]])
output = f:read("*l")
Then output
returns as nil
.
This behavior is true of any command involving the shared O: drive, not just type
. Similarly, I have some bat scripts that reference the O: drive, and I call these using os.execute
, but they are not able to accomplish their task (I can see they are actually executing, just not correctly). However, if I run similar commands or scripts with the local D: or C: drives, I do not have this issue.
Any ideas as to what could be different between these two calls? Is there a different way I can call the O: drive?
output = f:read("*1")
The*1
is invalid format. – Egor Skriptunoffio.popen[[net use O:]]:read"a"
? – Egor Skriptunoffio.popen([[net use O:]]):read("*a")
returns a blank output. I also triednet use \\IAS\o\
since this is the remote name of the drive, and this also returned a blank output. If I justread("*l")
on either of those I getnil
– Lane Taylorout, err = io.popen( cmd )
but nada... Might have to pipe stderr to temp.txt, then read it from there.out = io.popen( cmd 2> temp.txt )
– Doyousketch2