Search found 17 matches

by Szecska
15 Dec 2021 17:22
Forum: DOS Batch Forum
Topic: Finding /? in arguments
Replies: 7
Views: 7345

Re: Finding /? in arguments

You can use also Google as a search engine. just add site:dostips.com in the search bar after whatever you want to search for. Yeah, it does not work like this. Google cannot search punctuation marks and non alphanumeric symbols except for . and , ... And this is true to all major engines iikr. Tha...
by Szecska
14 Dec 2021 14:52
Forum: DOS Batch Forum
Topic: Finding /? in arguments
Replies: 7
Views: 7345

Re: Finding /? in arguments

You can use also Google as a search engine. just add site:dostips.com in the search bar after whatever you want to search for. Yeah, it does not work like this. Google cannot search punctuation marks and non alphanumeric symbols except for . and , ... And this is true to all major engines iikr. Tha...
by Szecska
11 Dec 2021 16:39
Forum: DOS Batch Forum
Topic: Finding /? in arguments
Replies: 7
Views: 7345

Re: Finding /? in arguments

Thanks Jeb, i have absolutely no idea why I didn't think about that, but it even works with echo: which I actually use pretty often :P
But really thanks, you saved me from a huge headache :)
by Szecska
10 Dec 2021 10:47
Forum: DOS Batch Forum
Topic: Finding /? in arguments
Replies: 7
Views: 7345

Finding /? in arguments

I'm 100% certain this question has been asked and answered already, but its literally impossibble to search for. I want to tell if the batch file's arguments contains `/?`. I need to check every possible postion, then if it's present show a help message just like a com application do. I tried (echo ...
by Szecska
18 Oct 2019 12:46
Forum: DOS Batch Forum
Topic: How to do change "Terminate batch job (Y/N)?"
Replies: 7
Views: 16128

Re: How to do change "Terminate batch job (Y/N)?"

Here's an example: @echo off setlocal enabledelayedexpansion && rem basic setup for %%I in ("%cd%") do set odrive=%%~dI & if not %%~dI==%systemdrive% %systemdrive% & rem This line corrects the strange behavior of replace /w and xcopy /w on fat32 drives by changing the path to the system drive :begin...
by Szecska
16 Oct 2019 14:47
Forum: DOS Batch Forum
Topic: How to do change "Terminate batch job (Y/N)?"
Replies: 7
Views: 16128

Re: How to do change "Terminate batch job (Y/N)?"

It can be done but you have to handle all the keyboard input. There's the 'xcopy /w' and 'replace /w' methods for that(getting all the keys), I will link them later. But if you just want a simple code, then it does not worth the effort. Ps: In older versions, there's the break command wich turns off...
by Szecska
08 Oct 2019 15:10
Forum: DOS Batch Forum
Topic: Really uexpected result of a script
Replies: 3
Views: 11101

Re: Really uexpected result of a script

Thaks for the replies!
Turns out Im an idiot, and I left out a second percent sign twice :oops: ...
by Szecska
08 Oct 2019 11:42
Forum: DOS Batch Forum
Topic: Really uexpected result of a script
Replies: 3
Views: 11101

Really uexpected result of a script

Hello everyone! I have a really annoying problem on hand witha really short script: set me=%~nx0 echo a for /f "tokens=*" %%G in ('dir "%~dp0" /b') do ( echo b if not %G == "%me%" ( echo c if %~zG == 32640 (echo %G %~zG b OK) else echo %G %~zG b MISMATCH ) ) pause It shows a sytax error at the line ...
by Szecska
28 Sep 2019 15:37
Forum: DOS Batch Forum
Topic: press no on external msgbox with yesno option
Replies: 3
Views: 11085

Re: press no on external msgbox with yesno option

There is a way, but its not pure batch. It uses a temporary vbs script: @echo off echo ret=Msgbox("Continue?",4,"Terminated.") 'msgbox(title,type,headline) Add 16 to type to show it as an error, 32 to question, 48 to warning, and 64 to information >%TEMP%\yn.vbs echo wscript.echo ret >>%TEMP%\yn.vbs...
by Szecska
31 Aug 2019 15:28
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 15
Views: 41319

Re: Multi-line menu with options selection via DOSKEY

@Aacini I found a strange thing lately,with this script: @echo off :null PowerShell Exit($host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown').VirtualKeyCode); echo %errorlevel% goto null this can detect arrow keys, but only as %&'( (key 37,38,39,40) So far this is the closest thing I could find for arro...
by Szecska
30 Aug 2019 05:25
Forum: DOS Batch Forum
Topic: ENABLEDELAYEDEXPANSION exclamation mark
Replies: 3
Views: 5588

Re: ENABLEDELAYEDEXPANSION exclamation mark

A similar question is being discussed:viewtopic.php?f=3&t=9250
by Szecska
22 Aug 2019 07:01
Forum: DOS Batch Forum
Topic: Batch Script Remove Space from Text Field.
Replies: 2
Views: 6164

Re: Batch Script Remove Space from Text Field.

Hi! You should really check out the "help set" command. Environment variable substitution has been enhanced as follows: %PATH:str1=str2% would expand the PATH environment variable, substituting each occurrence of "str1" in the expanded result with "str2". "str2" can be the empty string to effectivel...
by Szecska
21 Aug 2019 10:17
Forum: DOS Batch Forum
Topic: How <cr> behaves in a variable?
Replies: 2
Views: 5702

Re: How <cr> behaves in a variable?

Thank you very much Jeb :!:
It works :)
by Szecska
21 Aug 2019 06:09
Forum: DOS Batch Forum
Topic: How <cr> behaves in a variable?
Replies: 2
Views: 5702

How <cr> behaves in a variable?

Hi everyone! My problem is that I have no idea how to check if a variable is equal with a <cr>(0x0d) charater. So far what I got: The var key comes from a read key method (with either the "replace /w" or "xcopy /w" method) for /f skip^=1^ delims^=^ eol^= %%A in ('replace ? . /u /w') do set key=^%%A ...