1diff --git a/nox/command.py b/nox/command.py
2index 671875c..4984168 100644
3--- a/nox/command.py
4+++ b/nox/command.py
5@@ -30,6 +30,8 @@ TYPE_CHECKING = False
6 if TYPE_CHECKING:
7 from typing import IO
8
9+_PLATFORM = sys.platform
10+
11 ExternalType = Literal["error", True, False]
12
13
14@@ -63,7 +65,7 @@ def _clean_env(env: Mapping[str, str | None] | None = None) -> dict[str, str] |
15 clean_env = {k: v for k, v in env.items() if v is not None}
16
17 # Ensure systemroot is passed down, otherwise Windows will explode.
18- if sys.platform == "win32":
19+ if _PLATFORM.startswith("win"):
20 clean_env.setdefault("SYSTEMROOT", os.environ.get("SYSTEMROOT", ""))
21
22 return clean_env
23diff --git a/tests/test_command.py b/tests/test_command.py
24index ae398e9..904cf34 100644
25--- a/tests/test_command.py
26+++ b/tests/test_command.py
27@@ -157,7 +157,7 @@ def test_run_env_remove(monkeypatch):
28 )
29
30
31-@mock.patch("sys.platform", "win32")
32+@mock.patch("nox.command._PLATFORM", "win32")
33 def test_run_env_systemroot():
34 systemroot = os.environ.setdefault("SYSTEMROOT", "sigil")
35