If you want to avoid a runsettings file, you can use this workaround
Tests.cs
string browser = System.Environment.GetEnvironmentVariable("Browser") ?? "chrome";
Note: Selection of browser is through an environment variable. Defaults to Chrome if unprovided.
Tests.bat
set DIR=%~dp0
chdir /d %DIR%
SETLOCAL
SET Browser=firefox
dotnet test project.dll --filter TestCategory="Sanity"
Timeout 10
If you want to launch the test from an Azure DevOps (fka VSTS or TFS) pipeline, you can simply use the $(...) notation to inline variables
SET TestPassword=$(TestPassword)
dotnet test $(Build.SourcesDirectory)\MyCompany.MyProduct.UITests\MyTest.csproj --configuration $(BuildConfiguration) --collect "Code Coverage" --logger trx --results-directory $(Agent.TempDirectory)