Collections:
Other Resources:
Get Batch File Path Name Components
How to Get Batch File Path Name Components? I want to know the path name of the directory where the batch file is located.
✍: FYIcenter.com
To get different components of the batch file path name, you can use batch parameter modifiers on %0, which represents the batch file name.
Here is a batch file, Batch-File-Name.bat, that dumps the %0 parameter with different modifiers:
@echo off rem Batch-File-Name.bat - Show components of the batch file name echo 0 = %0 echo ~0 = %~0 echo ~f0 = %~f0 echo ~d0 = %~d0 echo ~p0 = %~p0 echo ~n0 = %~n0 echo ~x0 = %~x0 echo ~s0 = %~s0 echo ~a0 = %~a0 echo ~t0 = %~t0 echo ~z0 = %~z0 echo ~$PATH:0 = %~$PATH:0 echo ~dp0 = %~dp0 echo ~pd0 = %~pd0 echo ~nx0 = %~nx0 echo ~dp$PATH:0 = %~dp$PATH:0 echo ~ftza0 = %~ftza0
If you run the above batch file located at C:\fyicenter\Batch-File-Name.bat, you get the following output:
C:\fyicenter>Batch-File-Name.bat 0 = Batch-File-Name.bat ~0 = Batch-File-Name.bat ~f0 = C:\fyicenter\Batch-File-Name.bat ~d0 = C: ~p0 = \fyicenter\ ~n0 = Batch-File-Name ~x0 = .bat ~s0 = C:\FYICEN~1\BATCH-~2.BAT ~a0 = --a------ ~t0 = 11/22/2033 10:20 PM ~z0 = 552 ~$PATH:0 = C:\fyicenter\Batch-File-Name.bat ~dp0 = C:\fyicenter\ ~pd0 = C:\fyicenter\ ~nx0 = Batch-File-Name.bat ~dp$PATH:0 = C:\fyicenter\ ~ftza0 = --a------ 11/22/2033 10:20 PM 552 C:\fyicenter\Batch-File-Name.bat
⇒ Get Batch Parameter as File Path
2022-02-19, 8081🔥, 0💬
Popular Posts:
Where to find information about what services are running on Windows 7 and how to manage them? I wan...
How to uninstall OpenOffice.org 2.2? If you want to uninstall OpenOffice.org 2.2, you should follow ...
What is "Portable Device Enumerator Service" in my Windows XP service list? And how is "Portable Dev...
Can I disable Windows service "Distributed Link Tracking Client" to speedup my computer? Windows ser...
What is the "McClientAnalytics.exe" process on windows 7? Is the "McClientAnalytics.exe" process a v...