posted Mar 3, 2013, 8:05 AM by Chris Franklin
Asks you
xcopy /Y "C:\FIle.txt" "C:\file.txt.old" Doesn't Ask you
echo f | xcopy /Y "C:\FIle.txt" "C:\file.txt.old" |
posted Mar 3, 2013, 8:03 AM by Chris Franklin
Exampleset hour=%TIME:~0,2% set minute=%TIME:~3,2% set second=%TIME:~6,2% set dayofweek=%DATE:~0,3% set month=%DATE:~4,2% set daydate=%DATE:~7,2% set year2digit=%DATE:~-2% set year4digit=%DATE:~-4% Usage:: echo out the hour
echo %hour% |
posted Apr 11, 2012, 12:28 PM by Chris Franklin
[
updated Apr 11, 2012, 12:46 PM
]
logon.bat@echo off Setlocal EnableDelayedExpansion
:::: Set Server(s) Name SET _SRV1=Server1
:::: For Static Drive Letters, Set them here as fallows. SET _DRV.company=F: SET _DRV.construction=G: SET _DRV.PDP=H: SET _DRV.ILP=I: SET _DRV.PCR=J: SET _DRV.SP_Properties=K: SET _DRV.Quickbooks=L: SET _DRV.Premier QB=P: SET _DRV.Recycle=R: SET _DRV.farro=S: SET _DRV.Homes\%username%=T: SET _DRV.exec=X:
FOR %%A in (company construction PDP ILP PCR SP_Properties Quickbooks "Premier QB" Recycle farro exec Homes\%username%) DO ( SET DRVMP=%%~A SET DRVLR=
FOR /F "tokens=2* delims=.=" %%B IN ('SET _DRV.') DO ( IF %%B==!DRVMP! SET DRVLR=%%C )
IF NOT DEFINED DRVLR ( for %%D in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do CD %%D: 1>> nul 2>&1 & if errorlevel 1 set DRVLR=%%D: )
NET USE !DRVLR! /DELETE 1>> nul 2>&1 IF EXIST "\\%_SRV1%\!DRVMP!\allow.txt" ( net use !DRVLR! "\\%_SRV1%\!DRVMP!" /yes 1>> nul 2>&1 IF ERRORLEVEL 1 ( for %%D in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do CD %%D: 1>> nul 2>&1 & if errorlevel 1 set DRVLR=%%D: net use !DRVLR! "\\%_SRV1%\!DRVMP!" /yes 1>> nul 2>&1 ) echo Mapped Drive Letter !DRVLR! to \\%_SRV1%\!DRVMP! ) ) |
posted Mar 20, 2012, 10:56 AM by Chris Franklin
functionsfunction logit($txt) { $log = fopen('/tmp/mail.txt','a+');; fwrite($log,$txt."\n"); fclose($log); }
function SendMail($ServerName, $Port, $ToEmail, $FromEmail, $Subject, $Body, $Header = '', $Username = '', $Password = '') {
$smtp = fsockopen($ServerName, $Port); $InputBuffer = fgets($smtp, 1024); $GECode=220; if (substr($InputBuffer,0,3) != $GECode) { logit('Connect:'.$InputBuffer); fclose($smtp); return FALSE; }
fputs($smtp, "HELO $ServerName\n"); $InputBuffer = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit('HELO:'.$InputBuffer); return FALSE; }
if ($Username != '') { fputs($smtp,"AUTH LOGIN\n"); $smtpResponse = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit('AUTH'.$InputBuffer); return FALSE; }
if ($Username != '') { fputs($smtp, base64_encode($Username)."\n"); $smtpResponse = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; } }
if ($Password != '') { fputs($smtp, base64_encode($Password)."\n"); $smtpResponse = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; } } }
fputs($smtp, "MAIL From:<$FromEmail>\n"); $InputBuffer = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; }
fputs($smtp, "RCPT To:<$ToEmail>\n"); $InputBuffer = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; }
fputs($smtp, "DATA\n"); $InputBuffer = fgets($smtp, 1024); $GECode=354; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; }
fputs($smtp, "From: $FromEmail\n"); fputs($smtp, "To: $ToEmail\n"); if ($Header != '') { fputs($smtp, "$Header"); } fputs($smtp, "Subject: $Subject\n\n"); fputs($smtp, "$Body\r\n.\r\n"); fputs($smtp, "QUIT\n"); $InputBuffer = fgets($smtp, 1024); $GECode=250; if (substr($InputBuffer,0,3) != $GECode) { fclose($smtp); logit($InputBuffer); return FALSE; }
fclose($smtp); return TRUE; } Call$server = 'ssl://smtp.gmail.com ';
$port = 465; $to = 'bob@aol.com'; $from = 'norely@somewhere.com'; $subject = 'Hi Mom'; $message = 'blah blah blah';
SendMail($server,$port,$to,$from,$subject,$message,$headers,$auth_username,$auth_password); |
posted Mar 5, 2012, 10:58 AM by Chris Franklin
[
updated Mar 5, 2012, 11:47 AM
]
ExampleString="1 2 3 4 5" case $String in "1 2 3 4 5") echo "matches exactly";; "1 2 3"*) echo "matches at the start";; *"3 4 5") echo "matches at the end";; *"2 3 4"*) echo "matches in the middle";; *) echo "No Matches";; esac |
posted Mar 17, 2011, 11:05 AM by Chris Franklin
Scriptwmic printer where "PortName LIKE 'IP_%%'" delete |
posted Jan 3, 2011, 9:45 PM by Chris Franklin
[
updated Jan 3, 2011, 10:00 PM
]
Simple backup example::Path to robocopy set RC="C:\Program Files\Windows Resource Kits\Tools\robocopy.exe"
::Source Path (location of files that need to be backed up) set SP=M:\
::Destination Path (Where the backup lives) set DT=\\Server\Backup
::Remove all the non-existing from the destination that do not exist on the source %RC% /FFT %SP% %DT% /nocopy /PURGE /E
::Run mirror backup now %RC% /FFT /MIR %SP% %DT%
|
posted Dec 11, 2010, 9:45 AM by Chris Franklin
If your like me and using WinFLP ("Windows Fundamentals for Legacy PCs") then you've probably notice that when you choose not to install IE , Media player, etc. That the DirectX that it installs is not complete and well basically for that it is does well nothing for you as far as gaming goes. Well heres a script that will fix that for you. And heres what you'll need to run it. Another PC running Windows with the version of DX you want and still has the server service running. And next you'll need this script below (Your going to want to replace all "REMOTEPC" the with the name of your other PC). Side note : I do prefer running WinFLP on ANY PC that needs XP or "higher". For if no other reason then it runs smoother, uses up way less resources (basic install with themes still running only uses ~70-80 MB of ram, and I've even gotten it down to 50 Mb and with no functional loss to the user). It's got a lot smaller base (after install it only uses about ~650 MB HD space). And as far as functionality goes it identical to WinXP SP2. And again like I said I run this EVERY WHERE I "need" windows, regardless of how monster us the PC maybe !
Batch filexcopy /y \\REMOTEPC\C$\windows\system32\ddraw.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ddrawex.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dxapi.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3d8.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3d8thk.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3d9.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3dim.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3dim700.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3drm.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3dxof.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\d3dpmesh.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dplay.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dplayx.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpmodemx.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpwsock.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpwsockx.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dplaysvr.exe c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnsvr.exe c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnet.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnlobby.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnaddr.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpvoice.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpvsetup.exe c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpvvox.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpvacm.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnhpast.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpnhupnp.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dpserial.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dinput.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dinput8.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dimap.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\diactfrm.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\joy.cpl c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\gcdef.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dsound.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dsound3d.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dswave.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dsdmo.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dsdmoprp.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmusic.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmband.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmcompos.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmime.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmloader.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmstyle.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmsynth.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dmscript.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dx7vb.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dx8vb.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dxdiagn.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mfc40.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mfc42.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\wsock32.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\amstream.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\devenum.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\dxmasf.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mciqtz32.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\msdmo.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\encapi.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qasf.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qcap.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qdv.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qdvd.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qedit.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\qedwipes.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\quartz.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\strmdll.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\iac25_32.ax c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir41_32.ax c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir41_qc.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir41_qcx.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir50_32.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir50_qc.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ir50_qcx.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ivfsrc.ax c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mswebdvd.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ks.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ksproxy.ax c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ksuser.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\stream.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mspclock.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mspqm.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mskssrv.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\swenum.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mstee.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ipsink.ax c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\mpe.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\streamip.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\msvidctl.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\slip.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\nabtsfec.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\ccdecode.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\msyuv.dll c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\wstcodec.sys c:\windows\system32\ xcopy /y \\REMOTEPC\C$\windows\system32\wstdecod.dll c:\windows\system32\ |
posted Nov 20, 2010, 6:47 AM by Chris Franklin
[
updated Nov 20, 2010, 7:14 AM
]
Heres what I was trying to do - strip out all non english audio tracks
- strip out all subtitles except for signs/songs/opening/etc
- name each audio track by it's type (in this case "AC3, 5.1 channels")
- name the video track by the files title wiht out the name of the show (aka 01x01 - bob instead of Air - 01x01 - bob)
- remove all extra attachments to the files
To do this I mixed up a simple custom mkvmerge script and a find command. In mkvmerge script I needed to look at the given file name and create a title for ther video track from that. To do that I this.
Create titletitle=`echo "${file}" | sed -e 's/Air\ \-\ //g' | sed -e 's/\.mkv//g' | sed -e 's/\.\///g'` All that really amounts to taking something with the file name of and turning it into Next I needed to keep only the audio & subtitle tracks I wanted. which ended up looking like this Keeping only selected tracksBroken down "-a 2" means keep track #2 and treat it as a audio track. It does NOT mean keep audio track #2. mkvtools treats everything like a generic track regardless of that type of track it is. So you always care about the track NUMBER and nothing else.
The "-s 4" means keep track #4 and treat it like a subtitle. The "-M" means keep NO attachments (aka strip all attachments).
Now you might what to clean up the names of those tracks. To do that just use "--track-name " then the track number:Name_of_track like this. Name Tracks--track-name 1:"${title}" --track-name 2:"AC3, 5.1 channels" --track-name 4:"Signs and Songs" And put all toghter here is my runme.sh script that will be called by find.
runme.sh#!/bin/bash file=$1 title=`echo "${file}" | sed -e 's/Air\ \-\ //g' | sed -e 's/\.mkv//g' | sed -e 's/\.\///g'` echo $title mkvmerge -a 2 -s 4 -M --track-name 1:"${title}" --track-name 2:"AC3, 5.1 channels" --track-name 4:"Signs and Songs" -o "${file}.mkv" "${file}"
And here is find command. Find command usedfind -iname "*.mkv" ! -iname "*.mkv.mkv" -exec sh runme.sh '{}' \;
And in doing all this we went from this Org infoFile 'Air - 01x12 - Sora, Air.mkv': container: Matroska Track ID 1: video (V_MPEG4/ISO/AVC) Track ID 2: audio (A_AC3) Track ID 3: audio (A_FLAC) Track ID 4: subtitles (S_TEXT/ASS) Track ID 5: subtitles (S_TEXT/ASS) Attachment ID 1: type 'application/x-truetype-font', size 157360 bytes, file name 'MTCORSVA.TTF' Attachment ID 2: type 'application/x-truetype-font', size 57336 bytes, file name 'RotisWTF.ttf' Attachment ID 3: type 'application/x-truetype-font', size 842964 bytes, file name 'timesbd.ttf' Attachment ID 4: type 'application/x-truetype-font', size 751104 bytes, file name 'arialbd.ttf' Attachment ID 5: type 'application/x-truetype-font', size 56924 bytes, file name 'AVGARDNEclipse.ttf' Attachment ID 6: type 'application/x-truetype-font', size 32364 bytes, file name 'BellGothicStd-Black.otf' Attachment ID 7: type 'application/x-truetype-font', size 5178844 bytes, file name 'kaiu.ttf' Attachment ID 8: type 'application/x-truetype-font', size 848720 bytes, file name 'calibrib.ttf' Attachment ID 9: type 'application/x-truetype-font', size 172732 bytes, file name 'segoepr.ttf' Attachment ID 10: type 'application/x-truetype-font', size 172092 bytes, file name 'segoeprb.ttf' Chapters: 6 entries to this New InfoFile 'Air - 01x12 - Sora, Air.mkv.mkv': container: Matroska Track ID 1: video (V_MPEG4/ISO/AVC) Track ID 2: audio (A_AC3) Track ID 3: subtitles (S_TEXT/ASS) Chapters: 6 entries Which not only reduced the required space from 784 to 478 MB. But also cleaned up the track titles, made Eng of the only lang (thus the default). |
posted Nov 17, 2010, 11:29 AM by Chris Franklin
FireFoxfile://///hs/netlogon/proxy.pac
IEfile:////hs/netlogon/proxy.pac
|
|