Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows lua io.popen在路径中使用空格运行程序_Windows_Command Line_Lua - Fatal编程技术网

Windows lua io.popen在路径中使用空格运行程序

Windows lua io.popen在路径中使用空格运行程序,windows,command-line,lua,Windows,Command Line,Lua,我正试图启动这个程序,但一直出错。 我已经尝试在字符串和程序路径周围使用块引号[=[]=],但仍然不起作用 local test = string.format([==["C:\Program Files (x86)\Audacity\audacity.exe" "F:\Aufnahme %s.%s.%s\ZOOM0001.WAV"]==], tag, monat, jahr) print(test) io.popen(test) 感谢您的帮助:在Windows上,您必须将命令行程序+参数括

我正试图启动这个程序,但一直出错。 我已经尝试在字符串和程序路径周围使用块引号[=[]=],但仍然不起作用

local test = string.format([==["C:\Program Files (x86)\Audacity\audacity.exe" "F:\Aufnahme %s.%s.%s\ZOOM0001.WAV"]==], tag, monat, jahr)

print(test)
io.popen(test)

感谢您的帮助:

在Windows上,您必须将命令行程序+参数括在附加的外部引号中

local test = string.format([==["C:\Program Files (x86)\Audacity\audacity.exe" "F:\Aufnahme %s.%s.%s\ZOOM0001.WAV"]==], tag, monat, jahr)

test = '"'..test..'"'
print(test)
io.popen(test)
当您在CMD.EXE窗口中通过键盘键入命令时,处理键盘输入的代码会自动添加这些附加引号。 当您使用C函数系统或Lua函数os.execute、io.popen时,必须手动添加额外的引号。 这就是CMD.EXE的工作原理,它的设计充满了不太符合逻辑的决策