-
Notifications
You must be signed in to change notification settings - Fork 0
/
ins.pyw
50 lines (42 loc) · 1.57 KB
/
ins.pyw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
from tkinter import *
import subprocess
import time
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
def setap():
command = 'setx /M path "%path%;'+__location__+'"'
print(command)
f= open("usr.config","w+")
f.close()
f3= open("command.txt","w+")
f3.write((command))
f3.close()
"""
This is for Changing the Environt PATH Variable
process = subprocess.Popen(['runas', '/noprofile', '/user:Administrator', 'NeedsAdminPrivilege.exe', command], shell = True,stdout = subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
time.sleep(1)
frm.destroy()
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
line = str(output.strip().decode('ansi'))
print(line)
nms.config(Text = line)
nms.grid(row =2,column = 2)
"""
rt = Tk()
rt.geometry('400x180')
rt.resizable(False, False)
rt.title('Setup')
frm = Frame(rt)
frm.grid(row = 3, column =2)
tp = Label(rt, text = " ").grid(row =0,column =0)
bs = Label(rt, text = " ").grid(row =0,column =2)
msg = Message(rt, text = " Made by \nSanjib Kumar Sen\n Dept of CSE, BRAC University").grid(row =1,column =1, columnspan =3)
mid = Button(frm, text = "Intsall", command =setap).grid(row =3, column =2)
fs = Label(rt, text = " ").grid(row =2,column =2)
nms = Label(rt)
rt.mainloop()