Reputation: 49
trying to get this bat file to work, think I am close... can someone please help?
@echo on
for /f "delims=" %%i in ("netstat -anp TCP | find "ESTABLISHED"| find "3389"") do (
echo %date% %time% %%i >>C:\Users\xxxx\Desktop\rdp.csv
)
pause
Upvotes: 0
Views: 16
Reputation: 7095
Have you tried running your code without the file redirection?
Try this:
@echo on
for /f "delims=" %%i in ('netstat -anp TCP^| find "ESTABLISHED"^| find "3389"') do (
echo %date% %time% %%i
)
pause
You needed to escape your pipes and use single quotes in the for loop.
Upvotes: 2