Page 1 of 1

URL's to .txt file

Posted: 10 Feb 2021 04:49
by sk8ordie
Hi! (sry for my english)

i'm a newbie in batch..
how to write links to a .txt file line by line?
i use "copy" but this is not a good way bc output i get this line too "0 file(s) copied."

.bat file
@echo off
title Link's to txt file
REM for accent links
chcp 65001 > NUL
:LINK
set /p url="URL: "
copy "%url%" >> adress.txt
GOTO :LINK
adress.txt
https://www.dostips.com
0 file(s) copied.
https://google.com
0 file(s) copied.
i wanna to see in txt file just the links

https://www.dostips.com
https://google.com

this is possible in batch?
i don't want to use other .exe to do this (xcopy, robocopy, bitsadmin .....etc)

Re: URL's to .txt file

Posted: 10 Feb 2021 07:15
by penpen
The following might help you:

Code: Select all

@echo off
setlocal enableExtensions enableDelayedExpansion
title Link's to txt file
REM for accent links
chcp 65001 > NUL
:LINK
set "url="
set /p url="URL: "
if not defined url goto :eof
>>"adress.txt" echo(!URL!
GOTO :LINK
penpen

Re: URL's to .txt file

Posted: 10 Feb 2021 07:25
by sk8ordie
wow, perfect!
thank you so much!