Search found 3269 matches

by aGerman
12 Nov 2018 15:38
Forum: DOS Batch Forum
Topic: Can I get access to an ascii character not in the standard set?
Replies: 32
Views: 2575

Re: Can I get access to an ascii character not in the standard set?

Jerry Unbalanced quotation marks will certainly cause problems because they change the way the command lines are tokenized. Enable delayed variable expansion after you assigned the args variable and try again. @echo off setlocal rem test command-line arguments: x {a quote " and exclamation mark ! se...
by aGerman
04 Nov 2018 18:43
Forum: DOS Batch Forum
Topic: I need to fix variable ?
Replies: 6
Views: 126

Re: I need to fix variable ?

There is no reason to manipulate the second half of the line in your case. But for the first half you need to consider the escape character is an additional character, the left bracket is an additional character, etc. for the string saved in UN. @echo off &setlocal EnableDelayedExpansion for /f %%a ...
by aGerman
04 Nov 2018 15:03
Forum: DOS Batch Forum
Topic: I need to fix variable ?
Replies: 6
Views: 126

Re: I need to fix variable ?

It doesn't matter if the values change or not. I tried to explain it by setting values with different lengths. As you can see the way how to manipulate the values is always the same regardless of their initial length. The only constant variable that you need is spcs that contains a number of spaces ...
by aGerman
04 Nov 2018 10:52
Forum: DOS Batch Forum
Topic: I need to fix variable ?
Replies: 6
Views: 126

Re: I need to fix variable ?

Sounds like you want to pad strings with spaces. @echo off &setlocal set "spcs= " set "s1=abc" set "s2=abcde" set "n1=123" set "n2=12345" :: pad right REM conacatenate the string and the spaces set "s=%s1%%spcs%" REM output the first 20 characters echo %s:~0,20%end set "s=%s2%%spcs%" echo %s:~0,20%e...
by aGerman
02 Nov 2018 11:13
Forum: DOS Batch Forum
Topic: My batch Menu
Replies: 9
Views: 210

Re: My batch Menu

3 seconds not seeing any menu. Just something like "boot" which is misleading for a Batch script. Took ages for such a simple task, wasted my time. Closed the window, deleted the script.

Steffen
by aGerman
31 Oct 2018 09:54
Forum: DOS Batch Forum
Topic: I NEED THE PRECISE DATE FOR MY BATCH FILE
Replies: 4
Views: 135

Re: I NEED THE PRECISE DATE FOR MY BATCH FILE

Did you note that Squashman wrote DayOfWeek is in the interval 0 (for Sunday) to 6 (for Saturday)? @echo off &setlocal for /f %%i in ('WMIC PATH WIN32_LOCALTIME GET /Value') do for /f %%j in ("%%i") do set "%%j" set /a "DayOfWeek+=1" for /f "tokens=%DayOfWeek%" %%i in ("SUNDAY MONDAY TUESDAY WEDNESD...
by aGerman
16 Oct 2018 14:04
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 49
Views: 23220

Re: JREN.BAT - Rename files/folders using regular expressions

Microsoft still keeps some archives alive. But for the current JavaScript reference they link to the MDN. This is what I'm talking about (scroll to the end of the page): https://docs.microsoft.com/en-us/scripting/index That's the latest Microsoft archive about Regex https://docs.microsoft.com/en-us/...
by aGerman
15 Oct 2018 14:03
Forum: DOS Batch Forum
Topic: Deactivate admin privileges
Replies: 2
Views: 246

Re: Deactivate admin privileges

a.bat @echo off &setlocal :: If you run a batch script via "Run as administrator" then the working directory gets automatically changed to %SystemRoot%. cd /d "%~dp0" :: Test echo %~nx0 >nul 2>&1 net session &&(echo Elevated.)||(echo Not elevated.) :: Once the explorer already runs without elevation...
by aGerman
05 Oct 2018 13:59
Forum: DOS Batch Forum
Topic: For while loop or just a goto statement
Replies: 5
Views: 381

Re: For while loop or just a goto statement

You're right Squashman although I'm afraid the next question will be related to delayed expansion :lol:
by aGerman
05 Oct 2018 13:24
Forum: DOS Batch Forum
Topic: For while loop or just a goto statement
Replies: 5
Views: 381

Re: For while loop or just a goto statement

Sure you could use GOTO for an infinite loop. Another possibility is a FOR /L loop with an empty pair of parentheses.

Code: Select all

@echo off &setlocal
set /a n=0
for /l %%i in () do (call :sub &set /a n+=1)

:sub
REM Do whatever you need here
echo %n%
exit /b
Steffen
by aGerman
25 Sep 2018 01:34
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 6446

Re: FOR loop does not increment /L %%parameter

Do you know of an online microsoft document that explains in detail all these wmic sql dialect options ? ASSOC is a verb such as GET or CALL. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc784966(v=ws.10) I wouldn't call that a detailed explanation though. A...
by aGerman
24 Sep 2018 14:21
Forum: DOS Batch Forum
Topic: FOR loop does not increment /L %%parameter
Replies: 16
Views: 6446

Re: FOR loop does not increment /L %%parameter

I didn't read the whole thread ... I'm searching only for USB Flash devices What about for /f tokens^=2^ delims^=^" %%i in ( 'WMIC Path Win32_DiskDrive Where "InterfaceType='USB'" Assoc /assocclass:Win32_DiskDriveToDiskPartition 2^>nul ^|findstr /c:"Disk #"' ) do for /f tokens^=4^ delims^=^" %%j in ...
by aGerman
22 Sep 2018 03:06
Forum: DOS Batch Forum
Topic: Bodenstrich
Replies: 2
Views: 466

Re: Bodenstrich

The common language in this forum is English. Most of the people here come from all over the world and don't even understand your question. The blinking underscore you want to remove is the cursor. You can't do that using Batch but you can use tools that are able to do that for you. E.g. CursorSize....
by aGerman
21 Sep 2018 15:18
Forum: DOS Batch Forum
Topic: Cmdwiz - cmd helper tools (now with Unicode)
Replies: 37
Views: 7384

Re: Cmdwiz - cmd helper tools (now with Unicode)

That's quite annoying, I know :lol: I attached a resource file that you can use for C and C++ apps on Windows. I tried to keep it easy for you to update the values (using a little macro magic and some links to the documentations). Add it to your project, and after the compilation see what file prope...
by aGerman
21 Sep 2018 08:05
Forum: DOS Batch Forum
Topic: Batch file to copy and rename file with ipaddress.extension
Replies: 2
Views: 456

Re: Batch file to copy and rename file with ipaddress.extension

Try

Code: Select all

for /f "delims=: tokens=2" %%i in ('ipconfig^|findstr "\<IPv4"') do for /f "tokens=*" %%j in ("%%i") do copy "Expeditool.accdb" "Expeditool%%j.accdb"
The IP address is assigned to %%j in this example.

Steffen