Search found 3980 matches

by Squashman
18 Mar 2019 15:33
Forum: DOS Batch Forum
Topic: Modify a .txt file with a batch file (without a text editor)
Replies: 3
Views: 1365

Re: Modify a .txt file with a batch file (without a text editor)

How about you start with learning how to read a file using the FOR /F command. Then learn how to change the contents of a variable with the set command. Both of these commands have extensive help file documentation. Once you have mastered those two techniques individually you should be able to under...
by Squashman
18 Mar 2019 12:07
Forum: DOS Batch Forum
Topic: Modify a .txt file with a batch file (without a text editor)
Replies: 3
Views: 1365

Re: Modify a .txt file with a batch file (without a text editor)

There is no three and four in your example. All writing is done with redirecting Standard output to a file using the > symbol. Since Windows does not come with a stream editor you will need to use a FOR /F command to read the file and the SET command to do string substitution. Do a little research o...
by Squashman
16 Mar 2019 13:53
Forum: DOS Batch Forum
Topic: batch to overwrite files in all subdirectories in one folder if their names match with files in another folder
Replies: 10
Views: 1866

Re: batch to overwrite files in all subdirectories in one folder if their names match with files in another folder

Try to explain things in a logical order. Source is usually listed first and would be referred to as folder one or folder A. The destination is normally listed second and would be referred to as folder two or folder B.
by Squashman
14 Mar 2019 21:25
Forum: DOS Batch Forum
Topic: Lag methodology
Replies: 9
Views: 2355

Re: Lag methodology

Lots of examples of Date math on the forum. PowerShell is another good option because you can easily set the output format. You can even use XCOPY to help with date math.
by Squashman
14 Mar 2019 21:14
Forum: DOS Batch Forum
Topic: Syntax Problem - moving files in subdirs with white space in filename
Replies: 5
Views: 1174

Re: Syntax Problem - moving files in subdirs with white space in filename

Code: Select all

for /R "E:\photos" %%i in ("* 19*.jpg") do move "%%i"  "E:\your destination folder\"
by Squashman
14 Mar 2019 18:11
Forum: DOS Batch Forum
Topic: Syntax Problem - moving files in subdirs with white space in filename
Replies: 5
Views: 1174

Re: Syntax Problem - moving files in subdirs with white space in filename

Code: Select all

for %%i in ("E:\photos\* 19*.jpg") do move "%%i"  "E:\your destination folder\"
by Squashman
13 Mar 2019 19:56
Forum: DOS Batch Forum
Topic: Can I compare data using a command when using side by side function
Replies: 5
Views: 1282

Re: Can I compare data using a command when using side by side function

No. Pretty sure we have told you that batch files cannot interact with graphical user interface programs.
by Squashman
12 Mar 2019 08:01
Forum: DOS Batch Forum
Topic: Setting a variable value to single whitespace
Replies: 6
Views: 1372

Re: Setting a variable value to single whitespace

You do not use variable expansion with the IF DEFINED command.
by Squashman
11 Mar 2019 15:34
Forum: DOS Batch Forum
Topic: Get PID from port
Replies: 5
Views: 1328

Re: Get PID from port

You used it correctly in previous questions you have asked on the forums.

Eighth line of the help file for the FOR command.
To use the FOR command in a batch program, specify %%variable instead
of %variable. Variable names are case sensitive, so %i is different
from %I.
by Squashman
10 Mar 2019 13:22
Forum: DOS Batch Forum
Topic: How to substitute a variable
Replies: 2
Views: 788

Re: How to substitute a variable

Do not put spaces on either side of the equals symbol. If a space is on the left of the equals symbol it becomes part of the variable name: %var %. If it is on the right it becomes part of the value. Also do not assign quotes to variables but do you use them to protect special characters and from tr...
by Squashman
08 Mar 2019 10:28
Forum: DOS Batch Forum
Topic: Find a String
Replies: 9
Views: 1816

Re: Find a String

testingbatch wrote:
08 Mar 2019 10:23
The main goal is to find the 4 strings only about when the request is finished (ignore the 4 lines about the start).
You don't want the date and time stamp?
by Squashman
08 Mar 2019 10:01
Forum: DOS Batch Forum
Topic: Find a String
Replies: 9
Views: 1816

Re: Find a String

You need to show us a full example of the log file.
testingbatch wrote:
08 Mar 2019 08:42
That's why i asked if using a For would be a better option.
You never asked this in your original question.
by Squashman
07 Mar 2019 12:26
Forum: DOS Batch Forum
Topic: nested for loop not working as hoped
Replies: 2
Views: 871

Re: nested for loop not working as hoped

Your second for command is trying to execute a command because you are using the /F option and using single quotes within the in clause. You don't have a valid command within the in clause. Just remove the /F option and change the single quotes to double quotes which will execute a standard FOR comm...
by Squashman
04 Mar 2019 15:38
Forum: DOS Batch Forum
Topic: read a line from a txt file into a var , looping f.md5
Replies: 2
Views: 1058

Re: read a line from a txt file into a var , looping f.md5

You are inside a parentheses code block. All environmental variables inside a code block are expanded to their values before any commands are executed. In order to have the environmental variables expanded at run time of the command, you need to use delayed expansion.
by Squashman
04 Mar 2019 15:31
Forum: DOS Batch Forum
Topic: How to close cmd window?
Replies: 1
Views: 648

Re: How to close cmd window?

The ampersand is a special character that concatenates two commands onto one line. Not sure why you think you need it in your code.

Code: Select all

start "" notepad.exe
start "" mspaint.exe