Page 1 of 1

darg and drop: how to get short name of the parametre

Posted: 30 Oct 2006 16:10
by budhax
Hello,
my BAT file test.bat contains:

Code: Select all

set p1=%1
echo %p1%
pause


and I get:

"C:\Documents and Settings\sam\Bureau\folderA"


if I drag the folder "folderA" located on the desktop (=Bureau in French) and drop it on the test.bat file.

My goal is to get only folderA, without the full path and without the double quotes.

Anyone could help me, please? Thank you.

Posted: 30 Oct 2006 16:26
by budhax
I mean, at least without the full path.

Posted: 30 Oct 2006 18:37
by DosItHelp
budhax,

To get the directory name only without quotes try:
set p1=%~n1

DOS IT HELP? :wink:

Posted: 31 Oct 2006 05:13
by budhax
Thanks a lot, it helps me :o