Find text string in TXT hosted on Server.
Moderator: DosItHelp
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Find text string in TXT hosted on Server.
Friends, I need to search for a text string (Laptop Serial. Example 1SWA12F45G68B2) in a TXT file (Serials.txt), but this TXT file is hosted on an IP address of a server.
This Batch would run under the following Operating Systems: Windows XP, Seven and 10
Is there a way to do it from a Batch?
Thanks in advance for any help you can give me.
Excuse my English, I use a translator.
This Batch would run under the following Operating Systems: Windows XP, Seven and 10
Is there a way to do it from a Batch?
Thanks in advance for any help you can give me.
Excuse my English, I use a translator.
Re: Find text string in TXT hosted on Server.
So you know the name of the server. You know the severs ip address. You know the name of the file you need to search. You know what the search string is. What is your problem?
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: Find text string in TXT hosted on Server.
The problem is that I don't know how to do it
This is how I do it in the same directory.
@Echo Off
::test value
set serial=1S2887PS099XGA21
Find "%serial%" Seriales.txt >NUL
If %ERRORLEVEL% EQU 1 (
Echo serial does not exist : %serial%
) Else (
Echo Serial existe: %serial%
)
pause
This is how I do it in the same directory.
@Echo Off
::test value
set serial=1S2887PS099XGA21
Find "%serial%" Seriales.txt >NUL
If %ERRORLEVEL% EQU 1 (
Echo serial does not exist : %serial%
) Else (
Echo Serial existe: %serial%
)
pause
Re: Find text string in TXT hosted on Server.
So if you have files on another computer on your network how do you get to them?
(Teaching you to fish)
(Teaching you to fish)
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: Find text string in TXT hosted on Server.
I was looking for information about it, and on this page https://docs.microsoft.com/es-es/dotnet ... th-formats I found the following:
I guess it would be something like this:
I don't know if the double \\, the @ or the c$ is used
Thanks for your time
Code: Select all
@"\\127.0.0.1\c$\temp\test-file.txt"
Code: Select all
@Echo Off
::test value
set serial=1S2887PS099XGA21
Find "%serial%" @"\\127.0.0.1\c$\Seriales.txt” >NUL
If %ERRORLEVEL% EQU 1 (
Echo serial does not exist : %serial%
) Else (
Echo Serial existe: %serial%
)
pause
Thanks for your time
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Find text string in TXT hosted on Server.
You can't interact with remote files.
Download the file and interact with the local copy.
Download the file and interact with the local copy.
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: Find text string in TXT hosted on Server.
Thanks for answering.
And how do you copy a file located on a server?
Thanks in advance for the help.
And how do you copy a file located on a server?
Thanks in advance for the help.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Find text string in TXT hosted on Server.
curl, generally, since that's built into Windows 10 and 11.
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: Find text string in TXT hosted on Server.
And Curl can be used on Windows Xp and Seven ?
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Find text string in TXT hosted on Server.
You'd have to install it separately, but Windows XP and 7 are wildly out of date and shouldn't be used.
Re: Find text string in TXT hosted on Server.
For older operating systems, you could potentially use BitsTransfer with powershell as in this StackOverflow Answer:
https://stackoverflow.com/questions/302 ... lternative
https://stackoverflow.com/questions/302 ... lternative
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: Find text string in TXT hosted on Server.
Thank you for your answers.
Due to the activities we do, it is impossible to leave Windows XP (64bit) and Windows Seven.
At work we use three operating systems, Windows XP (64bit), Windows Seven and Windows 10.
So any code you make must be compatible with all three operating systems.
Regarding my question, and from what you guys say, it's impossible to do the following with Batch alone:
1- Look for the serial of the laptop in a txt file that is in another computer (server).
2- Copy a TXT file from one computer (server) to another computer (Laptop).
If these statements are correct, I have to find an alternative to look up the equipment serial in a list. It is essential that the serial is validated in the file or list.
So I'm wondering:
Will it be possible to search for the serial (text string) in a list that is on a web page on another computer (server)?
That is, query the serial at 192.168.100.2/serials.html or something like that.
Any ideas.
I am going to read about BITSAdmin.exe
Due to the activities we do, it is impossible to leave Windows XP (64bit) and Windows Seven.
At work we use three operating systems, Windows XP (64bit), Windows Seven and Windows 10.
So any code you make must be compatible with all three operating systems.
Regarding my question, and from what you guys say, it's impossible to do the following with Batch alone:
1- Look for the serial of the laptop in a txt file that is in another computer (server).
2- Copy a TXT file from one computer (server) to another computer (Laptop).
If these statements are correct, I have to find an alternative to look up the equipment serial in a list. It is essential that the serial is validated in the file or list.
So I'm wondering:
Will it be possible to search for the serial (text string) in a list that is on a web page on another computer (server)?
That is, query the serial at 192.168.100.2/serials.html or something like that.
Any ideas.
I am going to read about BITSAdmin.exe