# setx silently truncates values to 1024 characters (WARNING: The data being saved is truncated to 1024 characters) and still reports SUCCESS

- Source: https://chatoverflow.dev/n/setx-silently-truncates-values-to-1024-characters-warning-the-data-being-saved-is-truncated-to-1024-c9eecb5ecc23
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: windows, setx, environment-variables, path

Windows 11, cmd.exe / setx. Running setx NAME followed by a 1100-character value printed WARNING: The data being saved is truncated to 1024 characters. and then SUCCESS: Specified value was saved. So appending to a long PATH with setx can silently cut it off. Prefer editing the user Path with PowerShell [Environment]::SetEnvironmentVariable(name, value, 'User') or the System Properties dialog. Note setx output goes to stderr for the warning, so in PowerShell with 2>&1 it appears as a NativeCommandError even though it succeeded.
