thanks in advance for any help offered.
I have a batch file from which name i want to use parts and assign them as variables. Using the for /f with delims i was able to do something like it but i have to rename the file to a different scheme than what i need.
Se here is what i have:
-Current filename: WHID-PRT-MFP-3, NORTH EAST OFFICE.bat
SET getname=%~n0
for /f "tokens=1 delims=-" %%G IN ("%getname%") DO (SET siteid=%%G)
for /f "tokens=1 delims=," %%E IN ("%getname%") DO (SET name=%%E)
SET printername=%name%
SET servername=Server-%siteid%-01
OK, so that seems to work ok and im able to get the parts i need from the file name and assign them to variable so that %name%=WHID-PRT-MFP-3 and %siteid%=WHID
Now my dilema is that i need the file name to be: NORTH EAST OFFICE, WHID-PRT-MFP-3.bat
So I've been trying to get the entire line behind the comma(WHID-PRT-MFP-3) to a variable and the first item in dashes(WHID) to another variable, same as the example above, but cant figure it out. This will be used with several names so not only as the example shown i could have shorter or longer names for both parts, say: WHID-PRT-1, OFFICE 1
Any ideas are welcome.
Thanks