🔒 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
  • 513
    Views
  • 3
    Participants
Last reply from:
silent_babe

Trending Topics

Online now

Members online
1,369
Guests online
4,608
Total visitors
5,977

Forum statistics

Threads
2,311,058
Posts
29,160,443
Members
1,187,418
Latest member
lllllllsa
Back
Top