Friday, May 5, 2023

windows - Get current batchfile directory - Stack Overflow.Recognized Environment Variables (Windows 10) - Windows Deployment | Microsoft Learn

Looking for:

- Vector: トップ / ダウンロード / Windows10/8/7/Vista/XP//NT / ユーティリティ / バッチ用 













































     


How to Get Free Disk Space in PowerShell? - ://



 

Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search.

More info on the subject can be found on Microsoft's site. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Learn more. Get directory containing the currently executed batch script Ask Question. Asked 10 years, 3 months ago. Active 2 years, 4 months ago. Viewed k times. Maybe I should filter the path. If yes, how can I do it? Improve this question. The double dot takes it back past the filename. The directory containing the currently executed script is not necessarily the same as the current working directory CD!

I edited the question accordingly - it now avoids the term of "current directory". Add a comment. Active Oldest Votes.

Improve this answer. Cinnam 7 7 bronze badges. If the batch file is in a different directory, you get that other directory. MihaiDanila, no, that is not what OP asked. Actually I got to this question while searching for a way to get the current directory. This was the first hit on Google. The title obviously says current directory, although you're right about the content.

We're both right, but I think lain and I are more right about what the question actually conveys, in spite of what was intended by it. It's why I've upped lain's answer 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 37 37 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. Best practices for writing code comments. Featured on Meta. Related Hot Network Questions. Question feed. Server Fault works best with JavaScript enabled. Accept all cookies Customize settings.

   


No comments:

Post a Comment