.Net & SharePoint '07

Technical blog for .Net and all SharePoint 2007 related Information

About the author

Me(Prince) and my wife are B.E in I.T & C.S.E respectively.  I a certified MCPD: Web from 2007 Dec. I am Intrestes in Web Application, MOSS, EPM, etc.
Now working with Deira International School, as IT Application & Help Manager. I have started my career as "Software Developer" @  REACH Sewn Technologies and Consulting Pvt. Ltd, Bangalore India from Oct 2004 to Feb 2006, then as "Web & Intranet Developer" @ Fosroc International Ltd, Dubai from April 2006 to Sep 2009.
You can catch me on mail@jpy-tech.com or mail@princepy.com. Or on 00971 - 50 - 4284530 

Google Translate

Tag cloud

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

Comment RSS

Google Your Location


Windows Shell Scripting

 

You can get a lot more information using different modifiers:

%~0         - expands %I removing any surrounding quotes (")
%~f0        - expands %I to a fully qualified path name
%~d0        - expands %I to a drive letter only
%~p0        - expands %I to a path only
%~n0        - expands %I to a file name only
%~x0        - expands %I to a file extension only
%~s0        - expanded path contains short names only
%~a0        - expands %I to file attributes of file
%~t0        - expands %I to date/time of file
%~z0        - expands %I to size of file

The modifiers can be combined to get compound results:

%~dp0       - expands %I to a drive letter and path only (same as %cd%)
%~nx0       - expands %I to a file name and extension only
%~fs0       - expands %I to a full path name with short names only

Eg: C:\Temp>batchparams.bat c:\windows\notepad.exe

%~1 = c:\windows\notepad.exe
%~f1 = c:\WINDOWS\NOTEPAD.EXE
%~d1 = c:
%~p1 = \WINDOWS\
%~n1 = NOTEPAD
%~x1 = .EXE
%~s1 = c:\WINDOWS\NOTEPAD.EXE
%~a1 = --a------
%~t1 = 08/25/2005 01:50 AM
%~z1 = 17920
%~$PATHATH:1 =  
%~dp1 = c:\WINDOWS\
%~nx1 = NOTEPAD.EXE
%~dp$PATH:1 = c:\WINDOWS\
%~ftza1 = --a------ 08/25/2005 01:50 AM 17920 c:\WINDOWS\NOTEPAD.EXE

How to get Current Folder name in a batch file

@echo off
set source=%cd%
set folder=
for /f "tokens=*" %%a in ("%source%") do set folder=%%~na
echo The users folder name is %folder%

OR

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

 

Links


Posted by admin on Thursday, May 21, 2009 11:44 AM
Permalink | Comments (0) | Post RSSRSS comment feed