Search found 125 matches

by pstein
22 Jul 2015 02:41
Forum: DOS Batch Forum
Topic: How to check file size?
Replies: 1
Views: 2513

How to check file size?

I want to check if a file size is greater than a certain size (and perform some commands if yes).
So I need a code similar to

if filesize("myfile.txt") > 300 (
....)

How can I do this in a DOS batch script?

Thank you
Peter
by pstein
22 Jul 2015 02:38
Forum: DOS Batch Forum
Topic: Detecting two bytes and replacing them by one
Replies: 3
Views: 4340

Detecting two bytes and replacing them by one

In ny directory tree there are some (many) *.txt files which contain text which is UTF-8 encoded (without BOM maker). The text inside such a file may contain UTF-8 encoded german Umlaute which consist of TWO bytes. Example: xC3xB6 for o Umlaut = "ö" Now I want to convert all these occurenc...
by pstein
20 Jul 2015 06:45
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 31419

Re: How to put inner quotes in outer quotes in "for" loop?

Code: Select all

FOR /F %%A IN ('^""%mypath%\myprog" -someparameter "%myfile%"^"') DO SET %%A


This works great.
Thank you
by pstein
19 Jul 2015 09:39
Forum: DOS Batch Forum
Topic: How to put inner quotes in outer quotes in "for" loop?
Replies: 17
Views: 31419

How to put inner quotes in outer quotes in "for" loop?

Assume the following code: set mypath=D:\aaa\bbb ccc\ddd eee\ set myfile=D:\eee fff\ggg hhh\file123.txt FOR /F %%A IN ('"%mypath%\myprog" -someparameter "%myfile%"') DO SET %%A When I run this batch script I got an error 'D:\aaa\bbb' is not recognized as an internal or external c...
by pstein
19 Jul 2015 07:39
Forum: DOS Batch Forum
Topic: Need help to convert Unix Shell Script to DOS Batch Script
Replies: 4
Views: 4501

Need help to convert Unix Shell Script to DOS Batch Script

I have got a little Unix Shell Script for a freeare program called ImageMagick. There is also a ImageMagick version for Windows and I want to implement a certain task by using a corresponding DOS batch script. The Unix Shell Script lok like: test=`convert image.jpg -format "%[fx:(w/h>1)?1:0]&qu...
by pstein
13 May 2015 05:23
Forum: DOS Batch Forum
Topic: How to really(!) associate an file extension to new program?
Replies: 9
Views: 11023

Re: How to really(!) associate an file extension to new prog

As I found out meanwhile the command is available on Win 7: m So I entered (for testing purposes) on terminal at first (not in batch script): D:\tmp>Reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg /f ERROR: Delete request is partially completed. Everything is deleted...
by pstein
13 May 2015 04:41
Forum: DOS Batch Forum
Topic: How to really(!) associate an file extension to new program?
Replies: 9
Views: 11023

Re: How to really(!) associate an file extension to new prog

Ok, thank you.

How can I programmatically delete the mentioned Registry branch from DOS batch script?
by pstein
13 May 2015 04:28
Forum: DOS Batch Forum
Topic: How to really(!) associate an file extension to new program?
Replies: 9
Views: 11023

Re: How to really(!) associate an file extension to new prog

@npocmaka: Ok, I have exported the Registry branch into *.reg file. It looks like: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithLis...
by pstein
13 May 2015 03:56
Forum: DOS Batch Forum
Topic: How to really(!) associate an file extension to new program?
Replies: 9
Views: 11023

How to really(!) associate an file extension to new program?

In the past I registered all picture file extensions (like *.jpg, *.png, *.bmp) to be automatically opened (under 64bit Win7) with the XnView picture viewer. Now I want to switch for them to a new viewer FastStone Image Viewer. I want to do this programmatically from DOS batch file. Therefore I setu...
by pstein
10 Mar 2015 03:50
Forum: DOS Batch Forum
Topic: Question about performing "chkdsk" from batch at next reboot
Replies: 11
Views: 9131

Re: Question about performing "chkdsk" from batch at next re

Ok.

Can I create a task from DOS batch script (as cmdline) or do I have to click through multiple menus and dialoges and buttons and settings :-(
by pstein
10 Mar 2015 01:13
Forum: DOS Batch Forum
Topic: Question about performing "chkdsk" from batch at next reboot
Replies: 11
Views: 9131

Re: Question about performing "chkdsk" from batch at next re

Thank you.
But I still don't understand.

Ok /X is only for dismounting.

But assume I want to chkdsk drive D:\ at next reboot (even if I could dismount it in current session).

How can I achieve this?

Peter
by pstein
20 Feb 2015 00:48
Forum: DOS Batch Forum
Topic: Question about performing "chkdsk" from batch at next reboot
Replies: 11
Views: 9131

Question about performing "chkdsk" from batch at next reboot

Occasionally I want to perform a well know "chkdsk" command for my Win 7 system at next reboot. Since I do not always remember immediately the exact syntax I put the following command into a DOS batch script: chkdsk C: /F /V /R /X >D:\tmp\chkdskreport.log Mind the /X which means "perf...
by pstein
24 Jan 2015 08:01
Forum: DOS Batch Forum
Topic: Output numeric values with 2 digits after fraction?
Replies: 20
Views: 13432

Re: Output numeric values with 2 digits after fraction?

Ok, little mistake from me :-)

Thank you