Search found 529 matches

by Compo
29 May 2021 16:50
Forum: DOS Batch Forum
Topic: Need help
Replies: 14
Views: 383

Re: Need help

Or perhaps just this in the Command Prompt:

Code: Select all

%__AppDir__%findstr.exe /IS "Echo" Z:\*.bat
Which should list the full filename, the line number, and then the line containing the case insensitive string Echo of every .bat file on the Z: drive.
by Compo
27 Apr 2021 10:10
Forum: DOS Batch Forum
Topic: Taskkill %0
Replies: 6
Views: 791

Re: Taskkill %0

TASKKILL /F /FI "WINDOWTITLE EQ "%0"" would work if the i would not add "- file1" and so on. But if I add * to this command it doesn't work: TASKKILL /F /FI "WINDOWTITLE EQ "%0" *" Where is my mistake or does it not work this way? Untested, but have you tried including the wildcard within the doubl...
by Compo
20 Apr 2021 07:42
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

My script runs correctly in Windows 10. Okay, let me put this to you in a different way; your script does not work correctly in Windows 10 x64, if it is run in a 32-bit cmd.exe instance. It only works correctly in a 64-bit cmd.exe instance, on a Windows x64 OS, and a 32-bit cmd.exe instance on a Wi...
by Compo
19 Apr 2021 17:38
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

There were a couple of tricky things here: <snip /> <snip /> if "%processor_architecture%"=="AMD64" set "reg_value=%reg_value%4" set "reg_query=reg query "%reg_key%" /v %reg_value%" for /f "tokens=3" %%A in ('%reg_query%') do set "key=%%A" <snip /> I'd advise that you take account of my previous po...
by Compo
19 Apr 2021 08:17
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

What is strange is that PROCESSOR_ARCHITECTURE=x86 but it really is 64-bit computer. And Shadow tests if "%processor_architecture%"=="AMD64" but SET P shows PROCESSOR_ARCHITECTURE=x86 PROCESSOR_ARCHITEW6432=AMD64 So maybe PROCESSOR_ARCHITEW6432 should be tested and not PROCESSOR_ARCHITECTURE (I don...
by Compo
19 Apr 2021 04:56
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

Compo's version works. I will check both of them on XP later today. Just to clarify my body text: Here's an example, now tested successfully only on Windows 2000, and Windows 10 x64 in both 32-bit and 64-bit modes) <snip /> The only thing, I'm unsure about is whether the Windows XP x64, version of ...
by Compo
17 Apr 2021 14:01
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

Here's an example, now tested successfully only on Windows 2000, and Windows 10 x64 in both 32-bit and 64-bit modes) @Echo Off SetLocal EnableExtensions EnableDelayedExpansion Set "sKey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" Set PROCESSOR_ARCHITE | %SystemRoot%\System32\find.exe "64" 1>N...
by Compo
16 Apr 2021 07:22
Forum: DOS Batch Forum
Topic: Set Colum for every file to txt
Replies: 3
Views: 657

Re: Set Colum for every file to txt

Ignoring the 'maxbytesize', which seems to be unused, perhaps something like this is what you want: @Echo Off SetLocal EnableExtensions DisableDelayedExpansion Set "i=0" ( For /F "EOL=? Delims=" %%G In ('Dir /B /A:-D 2^>NUL') Do ( Set /A i += 1, # = %%~zG SetLocal EnableDelayedExpansion For /F "Toke...
by Compo
14 Apr 2021 12:08
Forum: DOS Batch Forum
Topic: Clobbered cmd.exe!
Replies: 7
Views: 1238

Re: Clobbered cmd.exe!

IcarusLives wrote:
14 Apr 2021 11:41
He's unable to access cmd.exe
I'm sorry IcarusLives, but I clearly read the opening post, where it was stated that there was a copy of cmd.exe in the x86 application location, \SysWOW64.

Both sfc.exe and dism.exe also have x86 versions in \SysWOW64, hence my advice.
by Compo
12 Apr 2021 19:05
Forum: DOS Batch Forum
Topic: Clobbered cmd.exe!
Replies: 7
Views: 1238

Re: Clobbered cmd.exe!

Have you tries the basics, as administrator, before resorting to a System Restore?

Code: Select all

sfc.exe /ScanNow

Code: Select all

Dism.exe /Online /Cleanup-Image /CheckHealth

Code: Select all

Dism.exe /Online /Cleanup-Image /ScanHealth

Code: Select all

Dism.exe /Online /Cleanup-Image /RestoreHealth
by Compo
12 Apr 2021 18:51
Forum: DOS Batch Forum
Topic: Windows (and Office?) product key finder
Replies: 13
Views: 1570

Re: Windows (and Office?) product key finder

miskox wrote:
12 Apr 2021 15:36
I am sure some of you would be more efficient (Aacini, aGerman...). This is not a competition... (yet).
If you want one of those two to assist you, send them a personal message, instead of telling everyone else that you feel they have less worth to you, and demotivating them.
by Compo
31 Mar 2021 09:41
Forum: DOS Batch Forum
Topic: How do I convert batch script arguments to pattern?
Replies: 6
Views: 1497

Re: How do I convert batch script arguments to pattern?

Please don't try to disrespect me, I was very clear in my opening statement of my last response. You've completely changed your input to include both spaces and doublequotes, and would obviously not therefore, be splitting the string on spaces, would you? You'd be splitting on a doublequote space do...
by Compo
31 Mar 2021 08:26
Forum: DOS Batch Forum
Topic: How do I convert batch script arguments to pattern?
Replies: 6
Views: 1497

Re: How do I convert batch script arguments to pattern?

If your input files are all unquoted, and do not contain spaces or other potentially poison characters, then you could probably simply use something like this:

Code: Select all

@Set "allinput=%*"
@Echo -ai!%allinput: = -ai!%
by Compo
31 Mar 2021 08:17
Forum: DOS Batch Forum
Topic: read sfc output
Replies: 4
Views: 1235

Re: read sfc output

There's some interesting observations made in the following StackOverflow post, which may potentially assist you.
by Compo
30 Mar 2021 13:58
Forum: DOS Batch Forum
Topic: Batch treat special characters as input errors
Replies: 8
Views: 1715

Re: Batch treat special characters as input errors

Your answer doesn't suit me either : I don't intend to use WMIC because I actually get the user profiles directly from the Active Directory using another tool. Plus, you have a style of code that only experienced users can understand (sorry if my answer doesn't suit you either). The method I used t...