URL's to .txt file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

URL's to .txt file

#1 Post by sk8ordie » 10 Feb 2021 04:49

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)

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: URL's to .txt file

#2 Post by penpen » 10 Feb 2021 07:15

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

sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

Re: URL's to .txt file

#3 Post by sk8ordie » 10 Feb 2021 07:25

wow, perfect!
thank you so much!

Post Reply