Trying to find a quick way to get the window path.

I am new to python. I know how to determine which os is installed, but I'm trying to find a quick way to get the path to the window, then go az (c: \ windows ... x: \ windows ...). Is there a quick way?

Edit: Something like% systemroot% in windows (gives the full path).

+4
source share
1 answer

you can use os.environ

import os
win_path = os.environ['WINDIR']

WINDIR is an environment variable set by windows that points to %SystemRoot%

+3
source

Source: https://habr.com/ru/post/1657276/


All Articles