Search found 118 matches

by PAB
30 Aug 2020 12:54
Forum: DOS Batch Forum
Topic: Can't get integration to work!
Replies: 0
Views: 631

Can't get integration to work!

Good evening, I have two lines of code which work individually . . . for /f "tokens=*" %%A in ('dir /b /a:-d') do echo %%~nxA %%~zA >> "Folders_Files.txt" dir /b /a:-d | findstr /v /i "Folders_Files.txt List_Folder_Files_1.bat" >> "Folders_Files.txt" I have tried so many variations but I can't seem ...
by PAB
29 Aug 2020 06:56
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1745

Re: Letter used in a variable.

@Echo off & Setlocal DisableDelayedExpansion (Set \n=^^^ %=Newline DNR=% ) Set CHECKDISK=For %%n in (1 2) Do If %%n==2 (%\n% For /F "Tokens=1 Delims={}" %%1 in ("!Key!") Do (%\n% echo/^& echo Run chkdsk %%~1: /F Y/N?%\n% For /F "Delims=" %%. in ('Choice /N /C:yn') Do If "%%."=="N" Endlocal^&Goto :M...
by PAB
26 Aug 2020 16:12
Forum: DOS Batch Forum
Topic: Change position of environment variables output!
Replies: 4
Views: 1442

Re: Change position of environment variables output!

wmic output takes a little more work, refer to the remarks for more. Well, thanks to your code and explanations I was able to achieve what I needed, thank you. In fact I have extended it to provide two more outputs as below. The first one [ CODE 1 ] is your one and works perfectly. My question is p...
by PAB
26 Aug 2020 15:50
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1745

Re: Letter used in a variable.

fyi, choice does accept numbers 0-9 in addition to alphabetical characters. Note using a for /f loop to iterate over the choice command will return letters in upper case, even if the choice options are declared using lower case. You can also obtain the available drives using wmic to define (and dis...
by PAB
17 Aug 2020 08:48
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1745

Re: Letter used in a variable.

Thank you ALL for the replies. I am a bit poorly at the moment so I am sorry that I have not got back to any of you. When I feel a little better I will thoroughly go through this whole thread and take it all in, and answer each of your posts individually. You are all brilliant at what you do. I thou...
by PAB
12 Aug 2020 08:35
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1745

Re: Letter used in a variable.

Thank you BOTH for the replies, it is very much appreciated. penpen So using your code I would end up with . . . set "Drive=" set /p "Drive=>Please enter the drive letter and press <Enter>: " for /f "delims=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" %%a in ("!Drive!") do (echo wrongInput ...
by PAB
11 Aug 2020 14:54
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 1745

Letter used in a variable.

I am on virtually the last bit of finishing my file thanks to all the excellent help, responses, and direction from the experts here. Besides the responses and advice given here in previous threads I have been doing my homework and my own investigations. On https://ss64.com/nt/if.html it says . . . ...
by PAB
11 Aug 2020 14:42
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 20
Views: 2167

Re: Only accept a numeric number.

Thank you Compo and Aacini for the replies.
I will look at them in more detail in the week and reply.
Sorry I haven't replied before but I have had a couple of intensive days at the hospital having tests etc.
by PAB
08 Aug 2020 14:23
Forum: DOS Batch Forum
Topic: [SOLVED] Output gets directed to the wrong folder!
Replies: 2
Views: 765

Re: Output gets directed to the wrong folder!

Hello OJBakker , Your "Report.bat" is located in PBU\bin So your code expands to PBU\bin\Reports\Reports.txt The code below will set the Output_File to PBU\Reports\Reports.txt cd /d "%~dp0" set "Output_File=..\Reports\Report.txt" You code also works as expected! Thank you, it is appreciated.
by PAB
08 Aug 2020 11:21
Forum: DOS Batch Forum
Topic: [SOLVED] Output gets directed to the wrong folder!
Replies: 2
Views: 765

[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" ...
by PAB
08 Aug 2020 11:17
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 20
Views: 2167

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.
by PAB
07 Aug 2020 13:58
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 20
Views: 2167

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 "...
by PAB
07 Aug 2020 13:31
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 20
Views: 2167

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...
by PAB
03 Aug 2020 17:54
Forum: DOS Batch Forum
Topic: [SOLVED] Console output to text file missing entries.
Replies: 2
Views: 809

Re: Console output to text file missing entries.

Squashman wrote:
03 Aug 2020 13:26
The basic syntax to append STDOUT and STDERR to a file.
command >> file 2>&1
Brilliant, thank you, it is appreciated!
by PAB
03 Aug 2020 13:17
Forum: DOS Batch Forum
Topic: [SOLVED] Console output to text file missing entries.
Replies: 2
Views: 809

[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 ...