Search found 967 matches

by jeb
15 Jan 2020 15:53
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 3017

Re: Redirect text to a file (runas command result)

How it fails, what is the error message or the unexpected behavior?

Do you can write files in the current directory at all?

Did you test it on the command line or somewhere inside a batch file?

Which Wndows version do you use?
by jeb
15 Jan 2020 01:20
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 3017

Re: Redirect text to a file (runas command result)

Hi avizee,

I tested

Code: Select all

echo( | runas /user:asdf "echo %date%" > test.txt
It works, the complete text is in test.txt.
The only difference to your first example, is the enclosing of echo %date% into quotes
by jeb
09 Jan 2020 00:02
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 2105

Re: cmd.exe chars needing quotes, and escaping redirection handles

Hi Dave, interessting. 1) Special characters listed in cmd help ... If completion is enabled with the /F:ON switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion. :o Dind't know this, nor read this before. But CTRl-F doesn't work for me ...
by jeb
31 Dec 2019 03:45
Forum: DOS Batch Forum
Topic: Batch file macro and SNAKE.BAT
Replies: 2
Views: 1365

Re: Batch file macro and SNAKE.BAT

Hi Meerkat, the parenthesis are necessary in macros, when you want to use the %\n% for multiple lines. That's because a raw line feed outside parenthesis stops the parser and the remaining stuff will be dropped. You can't compare it to the code from Snake.bat, as the code you shown is part of a func...
by jeb
19 Nov 2019 16:10
Forum: DOS Batch Forum
Topic: bat obfuscation with set ***=****
Replies: 5
Views: 3135

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

It's possible to expand a variable, begining with an asterix.

Code: Select all

set **.=SSS
setlocal DisableExtensions
echo %**.%
jeb
by jeb
02 Oct 2019 00:34
Forum: DOS Batch Forum
Topic: Enabling the internal debug outputs of cmd.exe
Replies: 17
Views: 22783

Re: Enabling the internal debug outputs of cmd.exe

No, it still works. At least with Microsoft Windows [Version 10.0.17134.1006] By using some nested FOR /F loops, I accidentally activated the debug mode. @echo off set "FOR_CMD=FOR /F "tokens=1-31" %%1 in ("jeb jeb") DO ^" %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CM...
by jeb
01 Oct 2019 14:28
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 9101

Re: Some tricks with undefined variables

@jfl Nice ECHO! macro I think 4) is useful when you want the definition of a macro to change depending on the state of some variable, for example if DEBUG is defined (enabled) or not. It allows incorporation of conditional text without creation of temp variables or staged definition 1- Me too, nice...
by jeb
01 Oct 2019 13:33
Forum: DOS Batch Forum
Topic: Enabling the internal debug outputs of cmd.exe
Replies: 17
Views: 22783

Re: Enabling the internal debug outputs of cmd.exe

There is still hope :D
Last week, I accidentially activated the debug outputs on Win10, by nesting some FOR /F loops (some hundreds).

Tomorrow, I will try to search the batch files and reproduce it.
by jeb
13 Sep 2019 03:33
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 9101

Some tricks with undefined variables

Hi, 1) Default values undefined variables are more or less empty variables, but only inside batch files. The difference for batch files and command line echo var: %undefinedVar% Output when executed on the command line: var: %undefinedVar% Output when executed in a batch file var: But even in batch ...
by jeb
07 Sep 2019 02:44
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 3699

Re: CALL myBatch.bat can return to the wrong place

I found one useful behaviour for the "missing stack entry". It works nearly the same as a GOTO, but there is one difference when it's in a command block or there are appended commands. A GOTO discards the other commands of a block and all appended commands (by &) @echo off echo [%0]: Before calling ...
by jeb
07 Sep 2019 02:15
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 3699

Re: CALL myBatch.bat can return to the wrong place

Hi siberia-man, thanks for the interesting link, I was able to understand the posts, thanks to google translate. You described the ? and * for labels, there both characters works as expected, like any other charcter. But the key difference is using them not in a lable, instead use them in a called f...
by jeb
06 Sep 2019 11:52
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 3699

CALL myBatch.bat can return to the wrong place

Hi, while refactoring my macro library, I found an unknown behaviour of the CALL/return file logic. :!: It fails when in the called batch file path at least one question mark or asterix is embedded. It seems a little bit related to the (goto) 2> nul glitch. First a sample, showing the normal behavio...
by jeb
06 Sep 2019 11:05
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 18666

Re: Closing parenthesis prevents escape of subsequent special character operator

Hi sst, I'm impressed by your analysis/debugging. :o :!: It explains so much. Now, I understand why the REM trick to gather the arguments works so good, and why it fails with multiline input. The REM parser will read the first token(GeToken) and compares it against "/?". If the token is "/?" it sets...
by jeb
29 Aug 2019 06:10
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 5018

Re: Replace "!" in a variable value when delayed expansion is on

Hi Penpen,

you are right. The Call is superfluous, I cpoied it from macro code.

@GCRaistlin
No it's not possible to use delayed expansion to replace a single bang, only when the bang is precede with other charactets.
by jeb
28 Aug 2019 11:24
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 5018

Re: Replace "!" in a variable value when delayed expansion is on

Hi GCRaistlin, yes, but it depends on the content of your string It's simple for simple content (without quotes in the content) @echo off setlocal DisableDelayedExpansion set "string=Test with caret ^ bang ! and some other <>&| %% stuff" setlocal EnableDelayedExpansion set "_tmp=%string:!=###%" set ...