What's new

Closed [batch] how to get filename from variable?

Status
Not open for further replies.

Such

Forum Veteran
Joined
Jul 1, 2017
Posts
770
Solutions
1
Reaction
5,308
Points
863
Kailangan ko kunin ang filename sa isang path variable.

For example, may variable ako na %RESULT% which contains "C:\Users\Admin\Desktop\file.txt"

Ngayon, gusto ko kunin yung "file.txt" from the %RESULT% variable, so i can put it into another variable like %FILENAME%


Paano ba to gawin?
 
call :getfilename "C:\Users\Admin\Desktop\file.txt"
exit /b

:getfilename
set FILENAME=%~nx1
pause >nul
 
Status
Not open for further replies.

Similar threads

Back
Top