    

 ## On this page

  

 

 # Command Line Arguments 

 Last update: 16.07.2025 

Pass command line arguments to the script with the syntax

> 'sos.exe -b cmd\_arguments.ssc filename 1 2'

Herein, the arguments "filename", "1", "2" are passed to the script as string variables.

Handle command line arguments in script ```` – check the number of script arguments

filename = sos.arg\[0\]; – get the first argument (as string) a = tonumber(sos.arg\[1\]); – get the second argument (as number) b = tonumber(sos.arg\[2\]); – get the third argument (as number)

if (b == nil) then error("The variable b '" .. sos.arg\[2\] .. "' is not a number."); end;

if (not fs.exists(filename)) then print("The path '" .. filename .. "' does not exist."); else if (fs.isDirectory(filename)) then print("The path '" .. filename .. "' is a directory."); end; if (not fs.isRegularFile(filename)) then print("The path '" .. filename .. "' is not a regular file."); end; end

print("" .. a .. " + " .. b .. " = " .. a+b)

print("Terminate script successfully."); ```