Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:19:39+00:00 2026-06-14T13:19:39+00:00

I am having trouble understanding what does following windows batch file do, can somebody

  • 0

I am having trouble understanding what does following windows batch file do, can somebody explain:

for /f %%i in ("%0") do set curpath=%%~dpi
cd /d %curpath% 
/*Some other code...*/
cd /d %curpath%
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:19:40+00:00Added an answer on June 14, 2026 at 1:19 pm

    %0 is the full path to the .bat file itself (if run from another directory) and ~dpi is a modifier to extract the drive and directory from a path omitting the file name, so this snippet sets the current drive & directory to the one in which the batch file lives.

    I can’t see the reason for using a FOR, %~dp0 does the same thing in one go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble understanding. With the following css : .bloc .field:nth-last-child(2){ ...some values... } and
I'm having trouble understanding what the following code does in a bash completion script:
Being fairly new to programming, I am having trouble understanding exactly what Homebrew does...
I'm having trouble understanding the dynamic keyword (used .net 2 up til recently). Can
I'm having some trouble understanding the IF clause at the end of this function
When designing both the domain-model and class-diagrams I am having some trouble understanding what
I'm having trouble understanding how to get the following working in interface builder. I've
I am having some trouble performing the following operation.. http://www.google.com --> www.google.com/ https://google.com -->
I am having some trouble understanding this brute force approach. I am using Perl
I'm having trouble understanding the following factorial program fact1(0,Result) :- Result is 1. fact1(N,Result)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.