Search found 139 matches
- 08 Aug 2020 11:21
- Forum: DOS Batch Forum
- Topic: [SOLVED] Output gets directed to the wrong folder!
- Replies: 2
- Views: 2978
[SOLVED] Output gets directed to the wrong folder!
Good evening, Part 1: I have a .bat file named "Report.bat". If I run "Report.bat" the output goes to the desktop . . . set "Output_File=%DesktopFolder%\Report.txt" I then use this for the "Report.txt" file output . . . > "%Output_File%" That all works great. Part 2: Now I have a folder named "PBU" ...
- 08 Aug 2020 11:17
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
WOW!, thank you penpen for taking the time to produce the detailed reply, it is very much appreciated. It is starting to finally make some sort of sense now thanks to you and others who take the time to respond to questions, not only for me, but for everyone.
Thanks again.
Thanks again.
- 07 Aug 2020 13:58
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
Hello Compo , Why didn't you try my single line example, (which was split over multiple lines for ease of reading) , instead of using those four lines? If Not Defined OS_Index (GoTo Menu)Else Set OS_Index|"%__AppDir__%findstr.exe" "^OS_Index=[123456789]$ ^OS_Index=1[012]$">NUL||GoTo Menu :Menu Set "...
- 07 Aug 2020 13:31
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
Hello penpen , I had to change that code because it didn't work and just exited the program. So I changed the % to ! and it works fine . . . You are wrong on that; the code is working without any issues. I suspect you removed the doublequotes around %OS_Index%, which would cause the behaviour you de...
- 03 Aug 2020 17:54
- Forum: DOS Batch Forum
- Topic: [SOLVED] Console output to text file missing entries.
- Replies: 2
- Views: 2824
- 03 Aug 2020 13:17
- Forum: DOS Batch Forum
- Topic: [SOLVED] Console output to text file missing entries.
- Replies: 2
- Views: 2824
[SOLVED] Console output to text file missing entries.
Good evening everyone. I have this cmd . . . for /f "tokens=*" %%i in ('wevtutil.exe el') do echo "%%i" & wevtutil.exe cl "%%i" & wevtutil.exe cl System When I run it, it outputs the list and any ERRORS to the console, great so far! I put that in a separate .bat file and called it from another .bat ...
- 03 Aug 2020 12:56
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
First of all, thank you to everyone who has contributed to this question, it is very much appreciated! You should change the order and use delayed expansion when testing for other characters, else someone could inject commands: for /f "delims=0123456789" %%a in ("!OS_Index!") do goto :Menu if "%OS_I...
- 31 Jul 2020 01:55
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
Good morning. Thanks for the help EVERYONE , it is appreciated. Here is the finished code. It will only accept numbers 1 to 12 which is what I want. It will hold the value of %OS_Index% so I can use it in several sections of the code further down. @echo off setlocal enabledelayedexpansion :Menu set ...
- 30 Jul 2020 16:59
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
Thanks Squashman , that works great. I will keep trying to sort out number [2] above if I can! Yes, I have always had a problem with quotes knowing when and when not to use them, but I am gradually getting to understand it a bit more. They say you can't teach an old dog new tricks, but I do try, rea...
- 30 Jul 2020 16:31
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Re: Only accept a numeric number.
Thank you BOTH VERY MUCH for the replies, it is appreciated. I have two problems . . . [1] I can' get the greater than 12 to work properly. [2] I can't seem to add an OS_Index variable that will hold the value of %userinput% . The reason for this is that I use %userinput% further down the code so se...
- 30 Jul 2020 09:54
- Forum: DOS Batch Forum
- Topic: Only accept a numeric number.
- Replies: 20
- Views: 12809
Only accept a numeric number.
Good afternoon! I want to be able to use the user input value as a variable further down some code rather than having to hard code the number. The code below works, but it relies on the fact that there actually is a number input and it is a number that is valid. Here is the test code I have got . . ...
- 30 Jul 2020 09:38
- Forum: DOS Batch Forum
- Topic: Quotation Marks.
- Replies: 2
- Views: 2791
Re: Quotation Marks.
Wow, THANK YOU jfl for the detailed reply and insight.
I will have to ponder on that for a while and investigate further to get it clear in my mind.
I will have to ponder on that for a while and investigate further to get it clear in my mind.
- 29 Jul 2020 11:13
- Forum: DOS Batch Forum
- Topic: Quotation Marks.
- Replies: 2
- Views: 2791
Quotation Marks.
Good afternoon, Being an old git, I have always had problems with knowing whether quotation marks should be used or not. When browsing the Internet, there are many bits of code out there, some of which use quotation marks and some that don't to achieve thae SAME thing. To try and clarify things in m...
- 24 Jul 2020 06:14
- Forum: DOS Batch Forum
- Topic: Extract data from a text file.
- Replies: 0
- Views: 15382
Extract data from a text file.
Good afternoon, I have managed to write the following which WORKS if there is ONLY one set of entries [ as per the %Filter% ] in the thousands of lines that appear in the CBS log. If there are more than one entry for each it outputs all of them! Is there any way that I can just get the LAST set of e...
- 22 Jul 2020 07:22
- Forum: DOS Batch Forum
- Topic: Problem with ELSE.
- Replies: 2
- Views: 3265
Re: Problem with ELSE.
I just couldn't seem to get it to do the WHOLE thing using If..Else...Else so I have come up with this . . . set "Drive=" echo Which drive would you like to check for ERRORS? set /p "Drive=>Please enter the drive letter and press <Enter>: " if /i not exist %Drive%:\ goto :ERROR if /i "%Drive%"=="C" ...