Hi guys, so i'm learning some batch, i know, arcane, but still i think it is relatively easy to learn and useful for some stuff, i know a bit of C, but that's about it, case in point, i am trying to make a website list logger, basically a batch file that:
- asks you to enter a website address, then saves it to a text file
- when you reopen the website logger batch file, it can pull the info from the text file to display the website lists as obviously, a list
- be able to choose from the list a website to open it
is pretty straight forward so i thought about arrays, but apparently is harder than it looks, so far, i got this examples from the guys at stackoverflow:
i know how i can modify this example to make it work to make the list, but it still doesn't solve the problem of being able to SAVE the website list to a text file and later on reopen the batch and list the SAVED websites on the batch program, i know how to copy variables to a text file and then READ it back to the batch program, but i can't find a way to:
-save variable to a text file and read it back and use it as a variable on the batch program,
any ideas on how this can be accomplish? any help is appreciated
You mention parsing variables to the batch file;
as in :
You can access the string "helloworld" with %1
Subsequent variables will be %2, %3 and so on.
You can find this info within 2 seconds on google.
The same goes for writing to a text file, super easy to find on google:
Quote:if you use a single ">" then you will overwrite the text file each time, ">>" will add another line each time.
echo string you want in the text file>>textfile.txt
Quote:will go through each line of the text file.
For /f "delims=" %%m in (textfile.txt) do (
I think if you made an effort you could find what you are looking for within one minute on google, would save you the time of posting a question here and waiting for someone to provide an answer. There is infinite resources on the web for batch programming.
Still struggling to see what the purpose of this script is and why you have chose batch for it, seems like the wrong thing to use (or at least seems like there would be a better solution to deal with websites n stuff). Are you sure the functionality you are looking for is not already included in a browser that you can download at the moment.
of course there are solution to this, i know that, bookmarks much? i just love the feeling of using the command prompt XD, and i do know how to use the commands you posted, my current code does all this and more, i can actually encrypt username and passwords using a batch script and save the data on a txt file and then decrypt and check the txt file database to be able to log in on a user account, etc, what i am trying to do is a little more complicated, as i said before
-i need to save variables, or plain text, to a text file << done
- i need to be able to find the plain text in the file, and use them as variables on the batch script so they can be used as a list:
i know i can make list using this syntax:
but what i am trying to do is to replace the items on the list, with text from a .txt file, get it? because the information (website address) will be added one by one manually, and i do not want to have a fixed list, like the code above, i want something dynamic, so i can change items as i wish from the batch program, and so far, i haven't been able to find a way where i can:
-find text on a text file and use it as a variable
i can find text on a file of course, but how to make it a variable?
|All times are GMT -7. The time now is 12:36 AM.|
Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
vBulletin Security provided by vBSecurity (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.