Computing.Net > Forums > Programming > get current folder name in var (DOS

get current folder name in var (DOS

Reply to Message Icon

Original Message
Name: adblockfreak
Date: April 23, 2008 at 14:38:30 Pacific
Subject: get current folder name in var (DOS
OS: XP
CPU/Ram: ?
Model/Manufacturer: Dell
Comment:

This is a response to an older post (thread is now closed), back in 2004, but that post the first result from Google for this problem. Since I had to find a solution for that problem today, I thought it might be relevant to post an update in case someone else can use it.

I was able to get the current folder name in a variable using the following commands:

for /F "delims=\" %%I in ("%CD%") do set e=%%~nI
echo.FolderName: %e%

This works for me in Windows XP even if the full path contains spaces.


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: get current folder name in var (DOS

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge