Search found 139 matches

by PAB
21 Jul 2020 17:30
Forum: DOS Batch Forum
Topic: Problem with ELSE.
Replies: 2
Views: 3290

Problem with ELSE.

Good evening, I have this code . . . set "Drive=" echo Which drive would you like to check for ERRORS? set /p "Drive=>Please enter the drive letter and press <Enter>: " if not exist %volume% %Drive%:\ ( echo ERROR: The drive does NOT exist^^! echo ^>Press ANY key to return to the Options . . . & pau...
by PAB
18 Jul 2020 02:13
Forum: DOS Batch Forum
Topic: [SOLVED] cmd prompt will not run maximized after CALL script ends.
Replies: 2
Views: 2905

Re: cmd prompt will not run maximized after CALL script ends.

the primary program resumes from the point the call is made - If the :menu label occurs prior to the call, it will not be parsed. Thanks for the reply, it is appreciated. Seeing as the default cmd prompt size is 80 columns x 300 lines, I got round it like this which is enough lines for my needs . ....
by PAB
17 Jul 2020 14:41
Forum: DOS Batch Forum
Topic: [SOLVED] cmd prompt will not run maximized after CALL script ends.
Replies: 2
Views: 2905

[SOLVED] cmd prompt will not run maximized after CALL script ends.

Good evening, I have a script where I want to CALL another batch script. call "%~dp0bin\Test_CALL_File.bat" The problem I am having is that the CALL ed batch script runs in a modified cmd prompt size using . . . mode con: cols=70 lines=9 & color 17 . . . and works great if it runs standalone. Now wh...
by PAB
17 Jul 2020 01:41
Forum: DOS Batch Forum
Topic: [SOLVED] Script closes when I press enter using set /p.
Replies: 2
Views: 3740

Re: Script closes when I press enter using set /p.

By pressing enter, the variable is undefined. So when you are not using quotes the execution of the command becomes: if /i ==0 goto Exit_Program That is invalid syntax. The safe way to compare strings as you found out is to use quotes. Thank you Squashman, it is appreciated. I also solved that if l...
by PAB
16 Jul 2020 18:06
Forum: DOS Batch Forum
Topic: [SOLVED] Script closes when I press enter using set /p.
Replies: 2
Views: 3740

[SOLVED] Script closes when I press enter using set /p.

Good evening, I hope everybody is OK and keeping SAFE ! I have a batch script that works well, except, if I DON'T enter a number and press < ENTER >, it exits the script. Here is the bit of code that I think is affecting it . . . setlocal EnableDelayedExpansion set "userinput=" set /p "userinput=>En...
by PAB
09 Jun 2020 14:17
Forum: DOS Batch Forum
Topic: Find will NOT find EXACT input!
Replies: 3
Views: 3546

Re: Find will NOT find EXACT input!

Thank you for the reply ShadowThief , it is very much appreciated! I just came up with this . . . @echo off set KB_Number= set /p KB_Number=^>Enter the KB Number: if [%KB_Number%]==[] ( echo Invalid. pause goto :Exit ) else ( echo Checking if %KB_Number% is installed . . . ) wmic qfe get hotfixid | ...
by PAB
09 Jun 2020 13:25
Forum: DOS Batch Forum
Topic: Find will NOT find EXACT input!
Replies: 3
Views: 3546

Find will NOT find EXACT input!

Good evening, I have the following which I have spent hours on . . . @echo off set KB_Number= set /p KB_Number=^>Enter the KB Number: KB if [%KB_Number%]==[] ( echo Invalid. pause goto :Exit ) else ( echo Checking if KB%KB_Number% is installed . . . ) wmic qfe get hotfixid | find /I "KB%KB_Number%" ...
by PAB
09 Jun 2020 09:59
Forum: DOS Batch Forum
Topic: Change position of environment variables output!
Replies: 4
Views: 4780

Re: Change position of environment variables output!

Thanks for the reply T3RRY , it is appreciated! The FsUtil FSInfo drives works brilliantly. As far as the wmic logicaldisk get caption, volumename is concerned, I waant the output as it is but with a space in front of each line of the output . . . Caption VolumeName C: D: F: Image Thanks in advance.
by PAB
09 Jun 2020 04:53
Forum: DOS Batch Forum
Topic: Change position of environment variables output!
Replies: 4
Views: 4780

Change position of environment variables output!

Good morning, I would like to adjust the position of two of the outputs of environment variables, if possible that is! [1] The first is fsutil fsinfo drives , which outputs on a seperate line Drives: C:\ D:\ F:\ for example. I would like it to output on the same line as the text below . . . echo The...
by PAB
07 Jun 2020 15:02
Forum: DOS Batch Forum
Topic: Extract UNIQUE rows ONLY from .txt file.
Replies: 4
Views: 4910

Re: Extract UNIQUE rows ONLY from .txt file.

OK, this actually works . . . ) else ( cls del "%Input_File%" type "%tmp%" | findstr /I /G:"%Filter%" >> "%Input_File%" del "%tmp%" echo. > "%Output_File%" & echo ERRORS FOUND . . . >> "%Output_File%" & echo. >> "%Output_File%" for /f "tokens=* delims= " %%a in (%Input_File%) do ( find "%%a" < "%Out...
by PAB
07 Jun 2020 11:51
Forum: DOS Batch Forum
Topic: Extract UNIQUE rows ONLY from .txt file.
Replies: 4
Views: 4910

Re: Extract UNIQUE rows ONLY from .txt file.

Thanks for the reply, it is appreciated. I have tried all different ways of getting this to work but I get at least one error on the PS side. One being . . . Method invocation failed because [System.Object[]] doesn't contain a method named 'ToLower'. At line:1 char:97 + $Contents=Get-Content 'C:\Use...
by PAB
07 Jun 2020 10:08
Forum: DOS Batch Forum
Topic: Extract UNIQUE rows ONLY from .txt file.
Replies: 4
Views: 4910

Extract UNIQUE rows ONLY from .txt file.

Good afternoon, I hope you are all keeping well and safe ! I have a .txt file that gets produced with many lines of text, which could include many duplicates. Here is the part of the code that creates the .txt file . . . type "%tmp%" | findstr /I /G:"%Filter%" >> "%Output_File%" [1] I want to exclud...
by PAB
27 May 2020 03:14
Forum: DOS Batch Forum
Topic: [SOLVED] Extract data to .txt file and then sort new file.
Replies: 10
Views: 8484

Re: Extract data to .txt file and then sort new file.

Thank you to everyone who contributed to my request, it is VERY much appreciated!
by PAB
24 May 2020 17:22
Forum: DOS Batch Forum
Topic: [SOLVED] Extract data to .txt file and then sort new file.
Replies: 10
Views: 8484

Re: Extract data to .txt file and then sort new file.

What I would finally like to do is to search a .txt file for the following sentences and have the rows that they appear in output to a file. The code below works great when finding "The drivers for this device are not installed". . . . @echo off Set "msinfo="C:\Program Files\Common Files\Microsoft S...
by PAB
24 May 2020 17:02
Forum: DOS Batch Forum
Topic: [SOLVED] Extract data to .txt file and then sort new file.
Replies: 10
Views: 8484

Re: Extract data to .txt file and then sort new file.

pieh-ejdsch wrote:
24 May 2020 09:28
use this

Code: Select all

find " 0 "
Thanks Phil, that does exactly what I was after!