Skip to content

Instantly share code, notes, and snippets.

@MoreOrLessSoftware
Last active October 16, 2025 14:45
Show Gist options
  • Select an option

  • Save MoreOrLessSoftware/746c841ae1804e4947779fe400b0837c to your computer and use it in GitHub Desktop.

Select an option

Save MoreOrLessSoftware/746c841ae1804e4947779fe400b0837c to your computer and use it in GitHub Desktop.
Change the Cyberpunk 2077 settings file to make the resolution and max FPS to match that of the primary display
# NOTE: This script requires the DisplayConfig PowerShell module.
# Install it with: Install-Module DisplayConfig
# 1. Get the current display resolution
$displayInfo = Get-DisplayInfo | Where-Object { $_.Primary }
$screenWidth = $displayInfo.Mode.Width
$screenHeight = $displayInfo.Mode.Height
$targetResolution = "${screenWidth}x${screenHeight}"
$targetMaxFps = [System.Math]::Ceiling($displayInfo.Mode.RefreshRate)
# 2. Define the path to your UserSettings.json file using the environment variable
$jsonFilePath = "$env:LocalAppData\CD Projekt Red\Cyberpunk 2077\UserSettings.json"
$backupFilePath = "$($jsonFilePath).bak"
# 3. Back up UserSettings.json if UserSettings.json.bak doesn't exist
if (-not (Test-Path -Path $backupFilePath)) {
Copy-Item -Path $jsonFilePath -Destination $backupFilePath -Force
Write-Host "Backed up UserSettings.json to UserSettings.json.bak"
} else {
Write-Host "Backup file UserSettings.json.bak already exists, skipping backup."
}
# 4. Read the UserSettings.json file
$jsonContent = Get-Content -Path $jsonFilePath | ConvertFrom-Json
# 5. Update the video display settings
foreach ($group in $jsonContent.data) {
if ($group.group_name -eq "/video/display") {
foreach ($option in $group.options) {
# Update the resolution
if ($option.name -eq "Resolution") {
Write-Host "Set Resolution = $targetResolution"
$option.value = $targetResolution
}
# Update the max FPS value
if ($option.name -eq "MaximumFPS_Value") {
Write-Host "Set MaximumFPS = $targetMaxFps"
$option.value = $targetMaxFps
}
}
break
}
}
# 6. Save the modified JSON back to the file
$jsonContent | ConvertTo-Json -Depth 100 | Set-Content -Path $jsonFilePath
Write-Host "Updated settings written to UserSettings.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment