Dan Dascalescu k 43 43 gold badges silver badges bronze badges. Stoleg Stoleg 8, 1 1 gold badge 18 18 silver badges 28 28 bronze badges. Look, I do not need to run stm. I need mysql. HamedKamrava is it for my SQL batch? Show 3 more comments. Pokechu22 4, 8 8 gold badges 36 36 silver badges 60 60 bronze badges. The code is short but it is not simple to understand.
What is this File. This answer actually answers the question, I think. Todua "setlocal" causes any environment changes, including current directory to be contained either until the batch file ends or a "endlocal" is encountered.
If you're going to change environment variables or the current directory, it's good form. Within your. This is not a good solution because it does not take into account the batch script being called from another file on another path. No need to copy it first. Here's what I use at the top of all my batch files. Wendell Holmes Wendell Holmes 1 1 silver badge 2 2 bronze badges. The question title should be renamed to be in sync with the question itself. Probably title of the article in the link could have been supplied, since the link is no more valid Show 1 more comment.
Mohammad: Indeed, it is the current directory. The other one is the directory where the batch file is. Those two are not the same and your question asks explicitly for this one. So please edit it if that is not what you mean. When we run batch file as an administrator then it returns path of System For the reader's reference - the question was originally using the term "current directory" while meaning the directory containing the script - this is now fixed.
Bart De Vos Anthony Miller Anthony Miller 3 3 gold badges 6 6 silver badges 19 19 bronze badges. Michael Hampton k 39 39 gold badges silver badges bronze badges. Same here: This was not the OP's intention - the question is now clearer.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Brian R. Bondy Brian R. Bondy k gold badges silver badges bronze badges. Add a comment. Active Oldest Votes. Parameter 0 is always the script itself. Community Bot 1 1 1 silver badge. Landon Landon Exactly what I needed. And I linked this anwser to my blog, as a reminder : — Olivier H.
Richard Neish 7, 4 4 gold badges 33 33 silver badges 68 68 bronze badges. Kev Kev k 50 50 gold badges silver badges bronze badges. This does not answer the question. Can you show me an example? IainElder - you're probably right, I re-visited this answer a few days ago and wasn't too happy with it. The comments on Raymond Chen's blog, which I refer to, seem to have been blitzed by MS - so therein lie the dangers of answers that rely entirely on linked external sources.
I did try to find some other material to back up my answer but it's so long ago in the mists of time now. Flagging for deletion.
0コメント