1.

Solve : Need just the pathname?

Answer»

I've got a bat file that will QUERY the registry for a setting and it gets string just fine, but the string data includes a filename and I want just the pathname from that.

Code: [Select]for /f "skip=2 tokens=3*" %%G in ('reg query "HKLM\SOFTWARE\ROCKSTAR Games\GTA San ANDREAS\Installation" /v Exepath') do set GAMEPATH="%%G %%H"This returns where the exe is, in my case "D:\Rockstar Games\GTA San Andreas\gta_sa.exe" but not everyone has GTASA installed in the same place, so I need just the "D:\Rockstar Games\GTA San Andreas".
try adding a second set that removes the exe name. SOMETHING LIKE this

Code: [Select]set gamepath=%gamepath:gta_sa.exe=%

I think that should do it.Worked perfectly, thanks.



Discussion

No Comment Found