sbatch command should be used to run jobs by default

srun and salloc commands should be used only if the user want to run interactive job and see the output on the screen.

TIP:  You do not have to create a special batch script file in order to run the job with the sbatch command, you can use the --wrap option to run the job directly from the command line. Example:

sbatch -N1 -j testjob -o job_%j.out -e job_%j.err --wrap 'hostname'

So basically you should first give an allocation of resources for the job(number of nodes, jobname, stdout and stderr files) and only after allocation you should add the --wrap option(not before!) and after the --wrap you can execute your job command.

More information can be on Slurm page: http://hivehpc.haifa.ac.il/index.php/slurm