🔒 Closed [batch] how to get filename from variable?

Status
Not open for further replies.

Such

Forum Veteran
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

About this Thread

  • 5
    Replies
  • 498
    Views
  • 3
    Participants
Last reply from:
silent_babe

Online now

Members online
864
Guests online
767
Total visitors
1,631

Forum statistics

Threads
2,275,128
Posts
28,960,856
Members
1,232,632
Latest member
kumyoung_101
Back
Top