Search found 223 matches

by pieh-ejdsch
26 Jun 2018 14:14
Forum: DOS Batch Forum
Topic: Change the influence of one batch file when other one is running
Replies: 3
Views: 1540

Re: Change the influence of one batch file when other one is running

Hello
To communicate from one to two you can use waitfor.
Otherwise open a writing handle from set /p into your one - in two test this writing handle also into one, if this doesn't success then goto yourLabel.
Phil
by pieh-ejdsch
22 Jun 2018 02:27
Forum: DOS Batch Forum
Topic: Creatively stupid ways to rename files with spaces to underscores
Replies: 10
Views: 3014

Re: Creatively stupid ways to rename files with spaces to underscores

I also tinkered a bit. I did not want to think about why I should make a goto out of the for loop. That makes no sense - but that's exactly why it should turn here. And well I admit it, I screwed up the loop with the delayed variable itself. - I was lazy - and had typed this snippet on the smart pho...
by pieh-ejdsch
21 Jun 2018 09:00
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3640

Re: which wildcard can be used in this case??

You do not have to add the file extension additionally. This is done in the variable with the for extension "%%~nxi".
by pieh-ejdsch
20 Jun 2018 13:56
Forum: DOS Batch Forum
Topic: which wildcard can be used in this case??
Replies: 13
Views: 3640

Re: which wildcard can be used in this case??

You can use this to rename:

Code: Select all

Setlocal enable delayedexpansion
For %%i in (*.doc)  do ( set "filename=%%~nxi"
  Set "filename=!filename: =_!"
  Ren "%%i" "!filename!"
   rem do something
)
I can't see what content your variable is.
Phil
by pieh-ejdsch
19 Jun 2018 09:03
Forum: DOS Batch Forum
Topic: What's wrong" For loop and pipe | "" problem
Replies: 3
Views: 1353

Re: What's wrong" For loop and pipe | "" problem

Hallo
Your findstr command will find lines with Peter OR Pan.
The for /f loop will only output the first token (word).
Use for /f "tokens=1-2" OR for /f "delims="
To set your variable.

Phil
by pieh-ejdsch
18 Jun 2018 02:23
Forum: DOS Batch Forum
Topic: convert file with 15 minute stock market data to hourly and daily
Replies: 4
Views: 1661

Re: convert file with 15 minute stock market data to hourly and daily

Hello purpleglow, is this an Example? @echo off setlocal enabledelayedExpansion set prompt=$g$s for /f "delims==" %%i in ('2^>nul set day[') do set "%%i=" set "day-=" for /f "usebackQtokens=1-5*delims=,.:" %%a in ("%userprofile%\desktop\.txt") do ( set /a "hour =(1%%d%%e -10830) /100" for /f "tokens...
by pieh-ejdsch
16 Jun 2018 09:36
Forum: DOS Batch Forum
Topic: .BAT script only running 1st command.
Replies: 3
Views: 1201

Re: .BAT script only running 1st command.

if NOT ERRORLEVEL 2 ( move "%BaseDir%\%RefNum%" "%DestDir1%" > "%temp%\popup.vbs" echo msgbox "DO NOT FORGET TO GO INTO DAVID DOWNLOADS FOLDER” wscript.exe "%temp%\popup.vbs" ) else ( choice /C YN /M "IS THIS A JAMES DOWNLOAD(Y/N)?" if NOT ERRORLEVEL 2 ( move "%BaseDir%\%RefNum%" "%DestDir2%" > "%t...
by pieh-ejdsch
12 Jun 2018 09:26
Forum: DOS Batch Forum
Topic: List directory and files
Replies: 2
Views: 1043

Re: List directory and files

Hello pp8771, you have started this batch twice in a command line prompt. Your batch has no setlocal. In the first run it saved the name of the last file into the variable file1. Your second run goes with the content of file1. You may use Enable delayedexpansion in the same codeline. But in your sit...
by pieh-ejdsch
04 Jun 2018 10:55
Forum: DOS Batch Forum
Topic: Stop Command Prompt Empty Line
Replies: 17
Views: 4926

Re: Stop Command Prompt Empty Line

I once tinkered with your createNest, because I first had to understand what should be done when. In addition, I had to create a similar test environment. Unfortunately, I do not have the "program" there. First of all, I can only repeat myself with the "program" quarreling around it. all other issue...
by pieh-ejdsch
04 Jun 2018 05:05
Forum: DOS Batch Forum
Topic: How to not merge folders already created
Replies: 5
Views: 1484

Re: How to not merge folders already created

Hello tweacle,
This want help you.

Code: Select all

Setlocal
PushD C:\Downloads
set "newFolder=newFolderName"
md "%newFolder%"
Move * "%newFolder%"
popD
Phil
by pieh-ejdsch
03 Jun 2018 06:01
Forum: DOS Batch Forum
Topic: Stop Command Prompt Empty Line
Replies: 17
Views: 4926

Re: Stop Command Prompt Empty Line

XY in questions often is a great problem. BTW if the echo is on- the CLI will print this empty line. Set prompt=$g$s Prog.exe Echo off Prog.exe Your batfile is with echo off. The output into redirected file doesn't have empty lines. Your example shows an output on the command line with the echo on. ...
by pieh-ejdsch
02 Jun 2018 12:05
Forum: DOS Batch Forum
Topic: Stop Command Prompt Empty Line
Replies: 17
Views: 4926

Re: Stop Command Prompt Empty Line

Hello, This prog.exe will print all these empty lines to your command line. It means the standard output isn't into handle1. Test the handle number for this output. Prog.exe 2>nul Prog.exe 3>nul ... Prog.exe 9>nul Or prog.exe to device CON still writes. Idon't now how to realize this con>nul ( prog....
by pieh-ejdsch
30 May 2018 08:52
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 3173

Re: How to mask a blank inside nested quotes?

In for /f loop - You only must create a first command token with no space

Code: Select all

for /F usebackq %%L in (`if 1 equ 1 "%PROG%myprog.exe" ...... %%F`) do set %%L
Phil
by pieh-ejdsch
28 May 2018 14:56
Forum: DOS Batch Forum
Topic: start .exe from 08:00 to 18:00 at every workday
Replies: 15
Views: 3809

Re: start .exe from 08:00 to 18:00 at every workday

Hi, Since nobody offered a solution so far ... I created the script to wait. It uses robocopy as mentioned in the other post. The start time to wait must be set before the first execution time. But it should at least be smaller or equal. The break time and the last possible execution time must also ...
by pieh-ejdsch
25 May 2018 04:11
Forum: DOS Batch Forum
Topic: How do i move files from series of folders
Replies: 7
Views: 1582

Re: How do i move files from series of folders

You mean so?

Code: Select all

PushD D:\rootfolder
For /r %%i in (*) do if "%%~fi" neq "%~f0" if NOT exist %%~nxi move "%%i"
Popd
Phil