Extract file name from windows file path.

I’m trying to do something very simple yet have a hard time getting it right. I have a file path that is showing up in windows format when it comes out of the ini file I am working with.

C:\Program Files (x86)\OnSSI\NetDVMS\Devices\IQEye6.dll

What I want to get from the file is just the file portion ie IQEye6.dll. This file portion changes in each part of the ini file so I need to find a way to remove just the file portion.

I have tried using the explode command but I cant seem to figure out how to make it break up the file at the 's. this would let me grab the last chunk as the file I need. All of the tutorials for breaking up file paths are using unix style file paths which would be easy.

$source=“C:\Program Files (x86)\OnSSI\NetDVMS\Devices\IQEye6.dll”;
$DLL_Source = explode(’"*"’, $source);

Any help with this or direction to search in would be greatly appreciated.

Sponsor our Newsletter | Privacy Policy | Terms of Service