I am reading a commandline string from a config file (config.json) :
"execmd" : "c:\\windows\\system32\\cmd.exe /c runscript.cmd"
I want to pass this to exec.Command() - but this function requires 2 parameters:
exec.Comm*emphasized text*and (cmd, args...)
Where cmd is the first segment (cmd.exe) and args would then be every space deliminated value thereafter.
I am not exactly sure if I need to read the config string, and then manually split it up in an array for each space deliminator? Is there any way of converting a string into args easily?
-
How would it be possible to do something like this, where I can refer args... from an index? (the below code doesn't work, cant refer args this way)
exec.Command (arg[0], args[1]...)