You can use the sapshcut.exe to connect to a SAP system via command line. Here is an example:
sapshcut.exe -system=SID -client=100 -user=YOURUNAME -pw=Y0urP4$$
Further command line options are described in SAPNote 103019 (link requires a SAP service marketplace account) or can be obtained with the command
sapshcut.exe -help