eg:
i have a file : abcxyz.apk
i want create program test.bat
when drag and drop file abcxyz.apk in test.bat
it show name file abcxyz
(file name is random)
help me program .bat when drag&drop any file it show name
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: help me program .bat when drag&drop any file it show nam
When you drag a file onto a batch script, the full path, including the file name, is stored in %1. You can get the file name without the extension by using %~n1.
Re: help me program .bat when drag&drop any file it show nam
ShadowThief wrote:When you drag a file onto a batch script, the full path, including the file name, is stored in %1. You can get the file name without the extension by using %~n1.
thank!!
but if i want click run test.bat to it's show file name then how to do ?
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: help me program .bat when drag&drop any file it show nam
The path and filename of the script itself are stored in %0. Again, you can get just the file name with %~n0.
Re: help me program .bat when drag&drop any file it show nam
now i want click to run not drag and drop file
picture :
http://www.upsieutoc.com/image/pF1Y
so how to do ?
-------------------------------------
drag drop file i have done
@echo off
title test
echo show file name
echo.
set name=%~n1
echo -------------
echo file name : %name%
echo folder path : %1
echo _____________
echo %~n1 >> litleboy.txt
echo %1 >> litleboy.txt
pause
picture :
http://www.upsieutoc.com/image/pF1Y
so how to do ?
-------------------------------------
drag drop file i have done
@echo off
title test
echo show file name
echo.
set name=%~n1
echo -------------
echo file name : %name%
echo folder path : %1
echo _____________
echo %~n1 >> litleboy.txt
echo %1 >> litleboy.txt
pause
Re: help me program .bat when drag&drop any file it show nam
Are you saying that you want the user to input the file name if the batch file is double clicked?