Use parent folder instead of cwd for launching files
This commit is contained in:
parent
630522d0bc
commit
fa36a061c1
2 changed files with 3 additions and 3 deletions
|
|
@ -4,4 +4,4 @@
|
||||||
Run `build.bat`, will result in a `shortcut.exe` file
|
Run `build.bat`, will result in a `shortcut.exe` file
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Run `shortcut.exe` or `shortcut.py` in a folder with `.lnk` or `.url` files
|
Run `shortcut.exe` or `shortcut.py` in a subfolder of a folder with `.lnk` or `.url` files
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
files = os.listdir()
|
files = os.listdir("..")
|
||||||
shortcuts = []
|
shortcuts = []
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
|
|
@ -9,4 +9,4 @@ for file in files:
|
||||||
shortcuts.append(file)
|
shortcuts.append(file)
|
||||||
|
|
||||||
file = random.choice(shortcuts)
|
file = random.choice(shortcuts)
|
||||||
os.startfile(file)
|
os.startfile(f"..\\{file}")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue