aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-01-30 18:24:23 -0800
committerJames Taylor <user234683@users.noreply.github.com>2020-01-30 18:24:23 -0800
commitcd4a2fb0ebb63600d9e66fa695c6517a968a78f8 (patch)
tree3b862e55c5e668a5e7543303c8323be824963f16
parentcf507e2cd1b9c4bc4c1c1c6a88298d076defafe5 (diff)
downloadyt-local-cd4a2fb0ebb63600d9e66fa695c6517a968a78f8.tar.lz
yt-local-cd4a2fb0ebb63600d9e66fa695c6517a968a78f8.tar.xz
yt-local-cd4a2fb0ebb63600d9e66fa695c6517a968a78f8.zip
run.bat: Allow command line usage from any directory
Set the youtube-local directory as the working directory, and use setlocal so it doesn't affect the shell the command is being run from.
-rw-r--r--run.bat9
1 files changed, 9 insertions, 0 deletions
diff --git a/run.bat b/run.bat
index a8f6032..26fb963 100644
--- a/run.bat
+++ b/run.bat
@@ -1,5 +1,14 @@
@echo off
+REM https://stackoverflow.com/a/25719250
+REM setlocal makes sure changing directory only applies inside this bat file,
+REM and not in the command shell.
+setlocal
+
+REM So this bat file can be called from a different working directory.
+REM %~dp0 is the directory with this bat file.
+cd /d "%~dp0"
+
REM This is so brotli and gevent search in the python directory for the
REM visual studio c++ runtime dlls
set PATH=.\python;%PATH%