Search found 3577 matches

by aGerman
12 Feb 2010 13:14
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 6981

Re: On Exit Do Command

Stergioss you're a joker Okay, I've got it to work: @echo off TITLE Keyboard Simulator MODE CON cols=41 lines=6 set ERRL=0 :a SET q1= SET q2= SET w1= SET w2= SET e1= SET e2= SET r1= SET r2= SET t1= SET t2= SET y1= SET y2= SET u1= SET u2= SET i1= SET i2= SET o1= SET o2= SET p1= SET p2= SET a1= SET a...
by aGerman
11 Feb 2010 07:03
Forum: DOS Batch Forum
Topic: Help! Help! - Simple search and store results in 1 of 3 file
Replies: 2
Views: 2307

Re: Help! Help! - Simple search and store results in 1 of 3 file

smehnert To append the different results to the same line is IMHO not a good idea, because batch can't handle strings >1024 characters. Figure out if this code would work for you. @echo off &setlocal set "outfile=results.txt" pushd "C:\" for /f "delims=" %%a in ('d...
by aGerman
10 Feb 2010 15:21
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 6981

Re: On Exit Do Command

avery_larry wrote:Actually, start /wait /b will disable Ctrl+C for the duration of that particular command.

You are right, but that doesn't change the fact that you can't disable it for the whole run time of a batch code.

regards
aGerman
by aGerman
09 Feb 2010 04:07
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 6981

Re: On Exit Do Command

My question was geared if you would need it for something special. Batch is a very primordial class. It is based on good old DOS and has a lot of limitations. Batch doesn't have any event handler. That means you can't figure out - which key is pressed - which mouse button is pushd - where the mause ...
by aGerman
08 Feb 2010 16:49
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 6981

Re: On Exit Do Command

No, you can't.
Also you can't disable Ctrl+C.

Why do you need it?

Regards
aGerman
by aGerman
08 Feb 2010 14:58
Forum: DOS Batch Forum
Topic: Find specific files from a directory and copy to a newfolder
Replies: 2
Views: 2058

Re: Find specific files from a directory and copy to a newfolder

lifeh2o Try if this will work for you. @echo off &setlocal set /a n=0 set /a m=0 for /f "delims=" %%a in ('dir /a-d /b /s "c:\*.log" "c:\*quiz*.htm"') do call :sub "%%a" goto :eof :sub if /i "%~x1"==".log" ( set /a n+=1 call set i=%%n%...
by aGerman
08 Feb 2010 05:24
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 6981

Re: On Exit Do Command

BAT Beginner

There is no command for such intention.
Batches are interpreted line by line. If you close the window this interpretation is interrupted and nothing else will go on.

Regards
aGerman
by aGerman
07 Feb 2010 18:26
Forum: DOS Batch Forum
Topic: Redirection Echo Output into .txt file
Replies: 3
Views: 2845

Re: Redirection Echo Output into .txt file

Chunter I don't know the given specifications, but if you have to process the data later you will get a problem if you can't find a data record in a single line. What ever. If you want to write it as a block you could do it like that :: [...] echo Total sales has been calculated as %total% echo Com...
by aGerman
07 Feb 2010 16:37
Forum: DOS Batch Forum
Topic: Redirection Echo Output into .txt file
Replies: 3
Views: 2845

Re: Redirection Echo Output into .txt file

Chunter You can't redirect the values to a file and to your screen using the same command, but you could write two command lines. e.g. echo Total sales has been calculated as %total% >>commlog.txt echo Total sales has been calculated as %total% But I think that's not exactly what you need. IMHO it ...
by aGerman
04 Feb 2010 09:09
Forum: DOS Batch Forum
Topic: Reverse command prompt action
Replies: 2
Views: 2048

Re: Reverse command prompt action

Peterr

Additional to !k's reply - the default line should be

Code: Select all

127.0.0.1       localhost


Regards
aGerman
by aGerman
03 Feb 2010 15:12
Forum: DOS Batch Forum
Topic: Create a batch to loop through files, run command & move
Replies: 3
Views: 3473

Re: Create a batch to loop through files, run command & move

Threep Your entire Batch is just one FOR loop written as a block. For your command line interpreter it looks like a single command line. Note that the expansion of variables occurs only one time during the run time of a command line. Thats why you can't see any changes of the %errorlevel% variable....
by aGerman
03 Feb 2010 07:39
Forum: DOS Batch Forum
Topic: How to check for installed softwares in a system
Replies: 5
Views: 2701

Re: How to check for installed softwares in a system

krisamigo sxekjb is right, this is also a possible solution. The first you have to do is allways searching for a meaningful key in the registry. Use any registry editor (e.g. regedit.exe). If you want to use the function of my url: @echo off &setlocal call :IsRegKey "HKLM\SOFTWARE\Adobe\Ac...
by aGerman
02 Feb 2010 14:15
Forum: DOS Batch Forum
Topic: How to check for installed softwares in a system
Replies: 5
Views: 2701

Re: How to check for installed softwares in a system

krisamigo There are different approaches. If it is a registered software you could have a look to your registry (HKEY_LOCAL_MACHINE\SOFTWARE) to figure out if a software is installed. See also http://www.dostips.com/DtCodeCmdLib.php#Function.IsRegKey . Otherwise you could look for a special exe fil...
by aGerman
02 Feb 2010 11:27
Forum: DOS Batch Forum
Topic: How to change all files to zero-byte?
Replies: 2
Views: 1702

Re: How to change all files to zero-byte?

auaa no idea what those could be good for Take a FOR loop and overwrite each file with 0 byte. @echo off &setlocal set "folder=C:\anywhere" pushd "%folder%"||goto :eof for %%a in (*) do ( type nul>"%%a" ) popd Every found file will be a blank file, also links! Rega...
by aGerman
01 Feb 2010 15:09
Forum: DOS Batch Forum
Topic: Batch for restart a services
Replies: 3
Views: 2420

Re: Batch for restart a services

avery_larry You are right. I misunderstood that kyosa asked for a service. net start | find /i "name of the service" >nul 2>nul || net start "name of the service" Will only try to start the service if it isn't running. Not that this method WOULD match partial service names. Exam...