String quotes in command arguments?

To start off, here’s my example code:



require("cmd")
function WriteFile()
	cmd.exec("echo 'test1' >> test.txt")
end


This code works fine. However, how would I accomplish using quotes in the argument? Example:


cmd.exec("echo ' "test" ' >> test.txt")

[lua]
local test = “test1”
cmd.exec(“echo ’ “…test…” ’ >> test.txt”)[/lua] ?

or do you mean
[lua]
cmd.exec(“echo ’ “test” ’ >> test.txt”)[/lua]

Either one works :smiley: Thanks!

EDIT: Is it possible to put quotes around a concatenation? like the first example, but if the “test” variable couldn’t have quotes. Like if I wanted to append player:GetName to text.txt so it shows up like “playername” in the file.

EDIT2: Nevermind, I figured it out!


 
local test = test 
cmd.exec("echo ' \""..test.."\" ' >> test.txt")


EDIT3: Erm, I’m getting “Unterminated String” when trying to run this…
EDIT4: Okay, last edits. I’m an idiot. I forgot that second ’ to close off the string.