To install features from the command line you can use DISM from PowerShell. This command will list the features:

dism /online /get-features /format:table

A variation of this command if you are looking for a certain feature:

dism /online /get-features /format:table |find "SMB1"

Example to install the feature:

Dism /online /Enable-Feature /FeatureName:SMB1Protocol
Dism /online /Enable-Feature /FeatureName:SMB1Protocol-Client

Here is an example batch script to install SMB1Protocol, disable deprecation, and turn on Network Discovery:

@echo off
Dism /online /Enable-Feature /FeatureName:SMB1Protocol | echo n
Dism /online /Enable-Feature /FeatureName:SMB1Protocol-Client | echo n
Dism /online /Enable-Feature /FeatureName:SMB1Protocol-Server | echo n
Dism /online /Disable-Feature /FeatureName:SMB1Protocol-Deprecation | echo n
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
msg * Reboot when ready/* Your code... */