본문 바로가기
파이썬 언어

Windows 의 Path 변수 표시하기 (Python 이용)

by treeCoder 2020. 11. 19.

Windows 에서 Path를 보려면 좀 번거로운 경우가 많다. 이것을 해결하기 위해서 파이썬 프로그램을 이용하면 좋다.

 

import os
file_name = '_p1a2t3h4.txt'

os.system('path > ' + file_name)

test_file = open(file_name, "r")
lines = test_file.readlines()

for itm in lines:
    if len(itm) > 0:
        splited = itm.split(';')
        for itm2 in splited:
            print(itm2)

test_file.close()
os.system('del ' + file_name)


msg = '''
**************

This is how to get to the path editing screen on windows machine

File explorer
right click on my pc
click on property (r)
advanced settings
environment variables

************** useful dos commands **************

prompt $s$g

set path=%path%;c:\
'''

print( msg )

 

댓글