Search found 3682 matches

by aGerman
15 Nov 2019 14:03
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file please help
Replies: 8
Views: 796

Re: batch file to search and copy particular file please help

Problem i think is here do i need this part or no ((
It's your code. You should know it better than me. I'd incorporate my loop instead and use variable %%j in the rest of this code snippet instead of %%a.
by aGerman
15 Nov 2019 13:38
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file please help
Replies: 8
Views: 796

Re: batch file to search and copy particular file please help

What did you try? And what particular problems are you facing?
by aGerman
15 Nov 2019 13:12
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file please help
Replies: 8
Views: 796

Re: batch file to search and copy particular file please help

So, my understanding is that you already have the code to copy the files you're looking for. The missing thing is how to find the USB drives. Give this a go: @echo off &setlocal for /f tokens^=2^ delims^=^" %%i in ( 'WMIC Path Win32_DiskDrive Where "InterfaceType='USB'" Assoc /assocclass:Win32_DiskD...
by aGerman
15 Nov 2019 13:01
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 31
Views: 10456

Re: Split string to characters

It doesn't help if you use CHCP 65001 in your code if your script isn't UTF-8-encoded (without Byte Order Mark).

Use a HEX editor and see if there is an invisible character somewhere before the missing substring.

Steffen
by aGerman
15 Nov 2019 11:42
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 31
Views: 10456

Re: Split string to characters

It might be helpful if you tell us about your Windows version, text editor, and encoding you used to save the code. Is it possible that this anomaly is caused by some difference in DOS versions? Not sure what version you're talking about, but I'm pretty sure it isn't DOS since DOS is an operating sy...
by aGerman
14 Nov 2019 11:49
Forum: DOS Batch Forum
Topic: bat obfuscation with set ***=****
Replies: 5
Views: 1485

Re: bat obfuscation with set ***=****

Still no feedback from the OP? @bakemonogatari No escape character will help here. You simply have to use alpha characters rather than asterisks. Why? That's why: %* *.% As soon as the cmd sees sequence %* it will try to expand it to the passed arguments. If no arguments have been passed to your scr...
by aGerman
14 Nov 2019 11:33
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 31
Views: 10456

Re: Split string to characters

I can't reproduce your problem. Your script example outputs ... Modified string: https: // www . some-site.com/index.php?pía┐selectí59í1í┐2í3┐┐í4?í55321íabcd ... which is absolutely expected since neither ¿ nor ¡ belong to ASCII. I saved the script in Windows-1252 (which is my default ANSI code page...
by aGerman
11 Nov 2019 10:45
Forum: DOS Batch Forum
Topic: SEARCH FOR FOLDERS WITHOUT PDF FILES
Replies: 1
Views: 699

Re: SEARCH FOR FOLDERS WITHOUT PDF FILES

Not sure about your folder structure. My test environment: - A folder with the test script and 3 subfolders a, b, and c. - Only folder b contains a PDF file (along with other files) @echo off &setlocal for /d %%i in (*) do if not exist "%%~i\*.pdf" echo %%i pause Output: a c Drücken Sie eine beliebi...
by aGerman
11 Nov 2019 05:49
Forum: DOS Batch Forum
Topic: Determine if laptop is running on AC or battery
Replies: 7
Views: 983

Re: Determine if laptop is running on AC or battery

If nothing helps I still can write two lines of C code for this purpose. Just let me know.

Steffen
by aGerman
10 Nov 2019 17:38
Forum: DOS Batch Forum
Topic: Play a sound (.wav) file, without opening an application
Replies: 4
Views: 863

Re: Play a sound (.wav) file, without opening an application

There has to be an application involved which is able to process and play your sound file. But the Windows Media Player provides an interface without window using ActiveX. It's not accessible with Batch directly. But you can use hybrid scripts such as npocmaka's mediarunner.bat. https://github.com/n...
by aGerman
09 Nov 2019 15:26
Forum: DOS Batch Forum
Topic: date and time format inconsistencies
Replies: 7
Views: 882

Re: date and time format inconsistencies

mrpaulc wrote:
09 Nov 2019 15:11
and maybe someone knows of a list of formats for locales.
It's dependent on Windows versions, too. There is no value in gathering a list of formats if you are already able to get the information locale-independent IMHO.

Steffen
by aGerman
09 Nov 2019 14:50
Forum: DOS Batch Forum
Topic: date and time format inconsistencies
Replies: 7
Views: 882

Re: date and time format inconsistencies

I assume the format specification is either hard-coded in the executable or (since it is locale-specific) in a .mui file.
However, how could you ever find this information in a binary file if you still want to use only built-in functions of the cmd?

Steffen
by aGerman
09 Nov 2019 12:47
Forum: DOS Batch Forum
Topic: date and time format inconsistencies
Replies: 7
Views: 882

Re: date and time format inconsistencies

What do you mean? wmic.exe belongs to the Windows command line tools just as reg.exe does. If using reg.exe is okay for you, what's wrong with wmic.exe?

Steffen
by aGerman
09 Nov 2019 11:59
Forum: DOS Batch Forum
Topic: date and time format inconsistencies
Replies: 7
Views: 882

Re: date and time format inconsistencies

We have large threads about date and time formatting in this forum. They point out that not even the values of the registry keys are reliable to find out how the cmd formats the strings. To cut a long story short - use WMIC. @echo off &setlocal for /f %%i in ('WMIC OS GET LocalDateTime /value') do f...
by aGerman
08 Nov 2019 10:41
Forum: DOS Batch Forum
Topic: Determine if laptop is running on AC or battery
Replies: 7
Views: 983

Re: Determine if laptop is running on AC or battery

Do hybrid scripts work for you? @if (@a)==(@b) @end /* @echo off &setlocal for /f %%i in ('cscript //nologo //e:jscript "%~fs0"') do set "PowerOnline=%%i" echo %PowerOnline% pause goto :eof */ var objWMIService = (new ActiveXObject('WbemScripting.SWbemLocator')).ConnectServer('.', 'root\\WMI'), colI...