|
Answer» how to log this batch file in one single logfile.txt I know I can do like this del /S /Q *.jpg>logfile.txt
but than I GET multiple logs, I need just one for batch belov
Code: [Select]del /S /Q *.gif del /S /Q *.jpeg del /S /Q *.tiff del /S /Q *.gif del /S /Q *.png del /S /Q *.bmp del /S /Q *.jpg del /S /Q *.tga del /S /Q *.pcx del /S /Q *.img
del /S /Q *.avi del /S /Q *.mov del /S /Q *.mpeg del /S /Q *.mpg del /S /Q *.mpe del /S /Q *.mpa del /S /Q *.qt del /S /Q *.asf del /S /Q *.asx del /S /Q *.wmv del /S /Q *.wma del /S /Q *.wmx del /S /Q *.rm del /S /Q *.ra del /S /Q *.ram del /S /Q *.rmvb del /S /Q *.mp4 del /S /Q *.3gp del /S /Q *.3pg del /S /Q *.ogg del /S /Q *.mkv
del /S /Q *.wav del /S /Q *.mp3 del /S /Q *.aiff del /S /Q *.3gp del /S /Q *.aac del /S /Q *.flac del /S /Q *.gsm del /S /Q *.m4a del /S /Q *.m4p del /S /Q *.mpc del /S /Q *.ogg del /S /Q *.wma
del /S /Q *.swf del /S /Q *.divx del /S /Q *.flv del /S /Q *.vhd del /S /Q "Backup%Files*.zip" This technique should work:
Code: [Select]echo off ( del /S /Q *.gif del /S /Q *.jpeg del /S /Q *.tiff del /S /Q *.gif del /S /Q *.png del /S /Q *.bmp del /S /Q *.jpg del /S /Q *.tga del /S /Q *.pcx del /S /Q *.img
del /S /Q *.avi del /S /Q *.mov del /S /Q *.mpeg del /S /Q *.mpg del /S /Q *.mpe del /S /Q *.mpa del /S /Q *.qt del /S /Q *.asf del /S /Q *.asx del /S /Q *.wmv del /S /Q *.wma del /S /Q *.wmx del /S /Q *.rm del /S /Q *.ra del /S /Q *.ram del /S /Q *.rmvb del /S /Q *.mp4 del /S /Q *.3gp del /S /Q *.3pg del /S /Q *.ogg del /S /Q *.mkv
del /S /Q *.wav del /S /Q *.mp3 del /S /Q *.aiff del /S /Q *.3gp del /S /Q *.aac del /S /Q *.flac del /S /Q *.gsm del /S /Q *.m4a del /S /Q *.m4p del /S /Q *.mpc del /S /Q *.ogg del /S /Q *.wma
del /S /Q *.swf del /S /Q *.divx del /S /Q *.flv del /S /Q *.vhd del /S /Q "Backup%Files*.zip" )>file.logthanks, I get log now, but I get only succesfull deleted files log. But I need also files which are access denied, or some else errors why file can not be deleted. why there is not all in log, do I need something else to do?It helps if you explain exactly what you need.
Try this:
Code: [Select]echo off for %%a in (
*.gif *.jpeg *.tiff *.gif *.png *.bmp *.jpg *.tga *.pcx *.img
*.avi *.mov *.mpeg *.mpg *.mpe *.mpa *.qt *.asf *.asx *.wmv *.wma *.wmx *.rm *.ra *.ram *.rmvb *.mp4 *.3gp *.3pg *.ogg *.mkv
*.wav *.mp3 *.aiff *.3gp *.aac *.flac *.gsm *.m4a *.m4p *.mpc *.ogg *.wma
*.swf *.divx *.flv *.vhd "Backup%Files*.zip" ) del /S /Q "%%~a" >> "file.log" 2>&1
Here is another way:
Code: [Select]echo off del /S /Q *.gif *.jpeg *.tiff *.gif *.png *.bmp *.jpg *.tga *.pcx *.img *.avi *.mov *.mpeg *.mpg *.mpe *.mpa *.qt *.asf *.asx *.wmv *.wma *.wmx *.rm *.ra *.ram *.rmvb *.mp4 *.3gp *.3pg *.ogg *.mkv *.wav *.mp3 *.aiff *.3gp *.aac *.flac *.gsm *.m4a *.m4p *.mpc *.ogg *.wma *.swf *.divx *.flv *.vhd "Backup%Files*.zip" > "file.log" 2>&1 There is a problem in this term though: "Backup%Files*.zip" because a single percent sign has to be doubled, or you are missing a percent sign if it is supposed to be a variable.I have removed that line but it is the same
Quote from: Blisk on September 23, 2014, 10:54:49 AM I have removed that line but it is the same
Are you trying to tell us something?
Quote from: foxidrive on September 23, 2014, 07:12:27 PMAre you trying to tell us something?
Yes, still not getting full log of what I see in cmd when start this batch file. Have you any IDEA what can be worng?
Quote from: Blisk on September 23, 2014, 11:48:10 PMYes, still not getting full log of what I see in cmd when start this batch file. Have you any Idea what can be worng?
So you want to log everything? Not just the command that you gave as a singular example.everything what I get on screen when I run that in cmd.Check out [ulr=http://www.dostips.com/forum/viewtopic.php?f=3&t=5386&p=32561&hilit=tee#p32561]batchTee.bat[/url] by dbenham.If you want to see it on the screen and log it to a file then you would need to use some iteration of TEE. If you just want to log everything when you type it in from the command prompt then just do this.
Code: [Select]C:\>MyBatchfile.bat >>logfile.txt 2>&1Remember if you really want to see everything then you need to make sure you are not suppressing any output with the ECHO OFF command. By default it is on but you might as WELL put ECHO ON at the top of your batch file just to be on the safe side.I don't have echo off in batch file and I just want to log all what I see in cmd when I run batch file.
Quote from: Blisk on September 26, 2014, 01:21:09 AMI don't have echo off in batch file and I just want to log all what I see in cmd when I run batch file.
Quote from: Lemonilla on September 24, 2014, 08:37:08 AMCheck out batchTee.bat by dbenham.
This is what you need, look at it.I tested it and now it WORKS, thank you. I have make a mistake before I forget to add at the end of batch file this 2>&1
|