Reputation: 15
This for command will not accept the file extension. All i get is that it cant find "myth." Any ideas?
@echo off
goto s2
:s
for /f %%h in (\\WTAB-14R2S02\Users\100048201\Documents\Chat\Program_Files\last\%un%.last) do (
set currentchannel=%%h
)
pause
title /%currentchannel%
cls
ECHO ---------------Chat Messages---------------
TYPE \\WTAB-14R2s02\Users\100048201\Documents\Chat\Program_Files\channels\%currentchannel%.channel
ping localhost -n 2 >nul
goto s
:s2
set un=myth
goto s
Upvotes: 0
Views: 34
Reputation: 70923
set un=myth
^ there is a space here
The space at the end is included in the variable value. Remove it or still better use quotes to prevent this problem
set "un=myth"
Or, if the space is really needed (and it will still be better to use quotes to better see it in the code), then you need to include the quotes to the file reference in for /f
command
for /f "usebackq" %%h in (
"\\WTAB-14R2S02\Users\100048201\Documents\Chat\Program_Files\last\%un%.last"
) do (
...
Note that usebackq
has been included to avoid the quoted file being treated as a direct string to be processed.
Upvotes: 2