Search found 13 matches

by Szecska
18 Oct 2019 12:46
Forum: DOS Batch Forum
Topic: How to do change "Terminate batch job (Y/N)?"
Replies: 7
Views: 4644

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: 4644

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: 4313

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: 4313

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: 4215

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: 11708

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: 1314

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: 1716

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: 1766

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: 1766

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 ...
by Szecska
16 Aug 2019 12:22
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 15
Views: 11708

Re: Multi-line menu with options selection via DOSKEY

@Sponge Belly @echo off & setlocal enableextensions disabledelayedexpansion (call;) title Menu Demo mode con lines=15 cols=20 (set lf=^ %= DO NOT DELETE =% ) set ^"nl=^^^%lf%%lf%^%lf%%lf%^" set ^"\n=^^^%lf%%lf%^%lf%%lf%^^" cls echo(Choose an Option:%nl%%\n% 1. Calculator%nl%%\n% 2. Disk Cleanup%nl%%...
by Szecska
15 Aug 2019 15:43
Forum: DOS Batch Forum
Topic: Problem with random number generator
Replies: 3
Views: 2743

Re: Problem with random number generator

Your problem is the file encoding. Cmd.exe can only read unicode characters and your file does not start with one. (I know because i just run into the same problem today; this is the unicode LE encoding's symptom) As @AGerman said if you reopen notepad and save with ANSI encoding, the problem is gon...