Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

get filename without extension in BAT (Users)

posted by RayeR Homepage, CZ, 06.06.2023, 13:59

> Hi All!
>
> When specified on the command line: test.bat C:\test.txt
>
> echo %1 ->>> ok!! Filename
> echo "%~n1" ->>> does not work in freedos
>
> How to get file C:\test from file C:\test.txt ???

Why not use instead a name without extension as input parameter and then work with %1.txt and %1.exe in batch file? I know it's not ideal when you use commandline auto completition utility that will automatically fill the whole name with extension. Or as suggested include sed from freedos or djgpp to your toolchain.

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 21 users online (0 registered, 21 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum