Search found 45 matches

by Eureka!
16 Jan 2020 07:28
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 181

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

jeb wrote:
16 Jan 2020 07:17
This can't be correct [...]
I *knew* this was coming!
But it would take me too much time to specify when and what would be redirected under which circumstances.
I assumed @avizee would get the picture that the error message could not be redirected that way ...
by Eureka!
16 Jan 2020 04:55
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 181

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

and does not work 'cmd /c' com Please provide better feedback than "does not work" !! When you provide no password or the wrong one, the program will not be started, of course. When you enter (manually!) the password when entering this command: runas /user:administrator "cmd /c pause" You can see w...
by Eureka!
14 Jan 2020 16:13
Forum: DOS Batch Forum
Topic: Sync from a list file with
Replies: 2
Views: 73

Re: Sync from a list file with

Does this work for you?
(I'm not entirely sure what you want as you left important information out, like the exact structure of file_list.txt )

Replace the xcopy line with:

Code: Select all

    if exist "%src_folder%\%%~nxf" echo xcopy "%src_folder%\%%~nxf" "%%f"
(remove the "echo" when everything is OK)
by Eureka!
14 Jan 2020 14:05
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 181

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

Some remarks: runas.exe does not support entering a password through a pipe ("|"). If you want to pass a password, look at utilities like sanur (runas spelled backwards; basically a wrapper around runas.exe that feeds the password) or CPAU (joeware.net). (IIRC; must be at least 10 years since I used...
by Eureka!
11 Jan 2020 20:57
Forum: DOS Batch Forum
Topic: How to expand variable in another variable with string substitution?
Replies: 3
Views: 113

Re: How to expand variable in another variable with string substitution?

With delayedexpansion enabled: setlocal enabledelayedexpansion SET var[1]=12 SET var[2]=23 set #=1 SET displayvar=!var[%#%]! set displayvar With delayedexpansion disabled: setlocal SET var[1]=12 SET var[2]=23 set #=1 call SET displayvar=%%var[%#%]%% set displayvar Using your substitution method: (W...
by Eureka!
04 Dec 2019 20:00
Forum: DOS Batch Forum
Topic: My program isn't working as it should.
Replies: 2
Views: 476

Re: My program isn't working as it should.

It looks like you created (actually: not finished) a very complex way (replacing text from a certain position to see if the "," is still there and then shifting a position to repeat the process until you find what the number between the "," and the ":" is) to get this result: output[1]_x=0 output[1]...
by Eureka!
24 Nov 2019 07:43
Forum: DOS Batch Forum
Topic: single line in runonce
Replies: 4
Views: 660

Re: single line in runonce

If you want to expand a variable to its value in the same command line you have to enable delayed variable expansion [...] Or: @for %%i in (A:,B:,D:,E:,F:,G:,H:,I:,J:,K:,L:,M:,N:,O:,P:,Q:,R:,S:,T:,U:,V:,W:,X:,Y:,Z:,) do @if exist "%%i\autounattend.xml" (set "usb=%%i" & call echo the usb drive is "%...
by Eureka!
21 Nov 2019 15:36
Forum: DOS Batch Forum
Topic: Old Script on (relatively) new computer
Replies: 11
Views: 831

Re: Old Script on (relatively) new computer

replace for /F "tokens=*" %%B in ('dir /B/A-D/ONE "%%~nA.0*"') do ( set PG=!PG! %%~nxB ) with: for /F "tokens=*" %%B in ('dir /B/A-D/ONE "%%~nA.*"') do ( set PG=!PG! %%~nxB ) ( "%%~nA.0*" replaced with "%%~nA.*" to enable up to 999 pages) or even: for /F "tokens=*" %%B in ('dir /B/A-D/OE "%%~nA.*"')...
by Eureka!
21 Nov 2019 12:29
Forum: DOS Batch Forum
Topic: Old Script on (relatively) new computer
Replies: 11
Views: 831

Re: Old Script on (relatively) new computer

I have edited the script I posted to show where I think the closing parenthesis of the second for-loop should be placed:

for /F "tokens=*" %%B in ('dir /B/A-D/ONE "%%~nA.0*"') do (
set PG=!PG! %%~nxB
)
by Eureka!
20 Nov 2019 17:26
Forum: DOS Batch Forum
Topic: Old Script on (relatively) new computer
Replies: 11
Views: 831

Re: Old Script on (relatively) new computer

1. You missed the "(" and ")" again in your a.bat 2. You need quotes around %DST%%%~nA.PDF and similar : "%DST%%%~nA.PDF", not around set SRC="c:\test\src\" and set DST="C:\test\dest\" replace @echo off (first line of script) with @echo on to follow in detail at which step of the script the error co...
by Eureka!
20 Nov 2019 15:54
Forum: DOS Batch Forum
Topic: Start Application At A Specific Transaction With Batch File
Replies: 2
Views: 626

Re: Start Application At A Specific Transaction With Batch File

Read the documentation of your EVO application and search for command line options.
If it is possible to provide credentials this way, there you can find it.
by Eureka!
20 Nov 2019 15:45
Forum: DOS Batch Forum
Topic: Old Script on (relatively) new computer
Replies: 11
Views: 831

Re: Old Script on (relatively) new computer

What am I missing? It looks like a couple of () for the second FOR command (and " " around filenames in case the include spaces or special characters. Try it by: start CMD.exe CD /d c:\test\src Execute your script That way the CMD window will show you any possible erroirs. New code: @echo off & set...
by Eureka!
27 Oct 2019 02:24
Forum: DOS Batch Forum
Topic: Eliminating multiple empty lines
Replies: 4
Views: 4181

Re: Eliminating multiple empty lines

Unless at the beginning of the file :wink: You are right! Never occurred to me that a text file could start with empty lines :o In case it does (does it ever?): $INFILES = "T:\*.txt" $OUTFOLDER = "T:\test" gi $INFILES | % { ( gc -Raw $_ ) -creplace("^(`r`n){3,}","`$1`$1") -creplace("(`r`n){4,}","`r...
by Eureka!
26 Oct 2019 15:57
Forum: DOS Batch Forum
Topic: Find not working
Replies: 2
Views: 3428

Re: Find not working

by Eureka!
26 Oct 2019 15:45
Forum: DOS Batch Forum
Topic: Eliminating multiple empty lines
Replies: 4
Views: 4181

Re: Eliminating multiple empty lines

I have a 1000 text files and would like to replace three (or more) empty lines with two empty lines. How could I do this? That is, I'd like to replace three (or more) new line characters with two new line characters. 3 empty lines would require 4 "new line characters" .. BTW (and off-topic): I woul...