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, ∼9303🔥, 0💬
Popular Posts:
What are Download Program Files (DPF) for Internet Explorer (IE) 7 browser? Download Program Files (...
How to verify IIS configuration for PHP scripts? If you have followed our Configuring IIS for PHP Sc...
How to uninstall Yahoo! Install Manager? If you want to remove Yahoo! Install Manager from your syst...
What is "Superfetch" in my Windows XP service list? And how is "Superfetch" service related to SysMa...
Can I disable Windows service "Intel NCS NetService" to speedup my computer? Windows service "Intel ...