-
Notifications
You must be signed in to change notification settings - Fork 0
/
Paste.py
57 lines (36 loc) · 1.06 KB
/
Paste.py
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
51
52
53
54
55
56
57
import os
from sys import argv
import slash
import pyperclip
def replace_space(inputStr):
outputStr = ""
for c in inputStr:
if c == " ":
c = "\ "
outputStr = outputStr + c
return outputStr
# print(replace_space("test test test"))
Slash = slash.Slash()
input_string = " ".join(argv[1:])
input_string = input_string[3:]
print("in: " + input_string)
output = Slash.convert_slash(input_string)
output = "cd /mnt/c/" + replace_space(output)
print("out: " + output)
pyperclip.copy(output)
final_command = "startBash.bat"
#create dynamic bat file with command
file = open('startBash.bat', 'w')
file.write('C:\Windows\Sysnative\\bash.exe -c "' + output + ' ; exec bash"')
file.close()
print("final command : " + final_command)
os.system(final_command)
# os.system('start /wait cmd /c "dir"')
# os.system("start /wait cmd")
# os.system("dir")
# os.system("cd " + output)
# os.system("start /k PAUSE /wait cmd ")
# os.system("cmd /K C:\SomeFolder\MyApp.exe")
# os.system("Console.ReadKey()")
# output = pyperclip.paste()
# print(output)