sapshcut.exe command can be used to log in to SAP from command line as shown in below example:
Add the directory that contains the sapshcut.exe command to your system or user path. The sapshcut.exe command is installed as part of the SAP client into the following directory: C:\Program Files\SAP\FrontEnd\SAPgui
To add additional directories to the system or user path on Windows systems, select Control Panel > System > Advanced > Environment Variables.
The .bat file must be named sapshcut.bat must be located in your default path preceding the sapshcut.exe file.
The following parameters are passed to the sapshcut.bat file when called from a predefined Launch definition −
%1 keyword "-command" %2 transaction_name, for example: SM13 %3 keyword "-system" %4 SAP_system_identifier, for example: TV1 %5 keyword "-client" %6 client_number, for example: 100
The following example shows a sample sapshcut.cmd file. In this example, you use a different user ID and password when sapshcut is run through the Application Launch for the system TV1. All other SAP systems use the default logon parameters.
@echo off set sapshcut="C:\Program Files\SAP\FrontEnd\SAPgui\sapshcut.exe" if "%4" == "TV1" ( %sapshcut% %* -user=myid -password=mypwd ) else ( %sapshcut% %* )