for /f "tokens=1 delims= " %%i in ('net view ^| findstr /i "%1%"') do
(set name=%%i)
I get the following error message:
| was unexpected at this time.
yet when I run from a cmd prompt it works. I'm running this on a
windows 2003 server box.
TIA
Your pacing is wrong. Try e.g.
for /f "tokens=1 delims= " %%i in ('
net view ^| findstr /i "%1%"') do (
set name=%%i)
Just one alternative among several correct ones.
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip
Check your file again. Are you sure it has the ^ before the | as shown
above?
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
always post the exact source code you're using - don't retype it.
Timo's probably correct in analysing the space that you probaly have between
the caret and the pipe. The caret escapes the very next character, not the
next-significant character.
Second problem is "%1%" which should be "%1" - but this can give you strange
results, not the error of which you complain....
It turns out it was the second problem "%1%", when I changed that to
"%1" the problem was resolved.
Thanks for all the suggestions.