lontokyo Posted April 23, 2019 Share Posted April 23, 2019 (edited) Selamlar herkese, Konuyu nereye acacagimi bilemedigimden buraya acmis bulundum, hataliysam kusuruma bakmayin. Problemim .bat dosyasini editlemek ile alakali,, mevcut cmd dosyam ile dun tarihli excel dosyasinda mevcut olan makronun hersabah mesai baslamadan once calistirilmasini saglayip ilgili kisilere sonuclari atmaktayim. Sikintimiz su; bugun icin dun tarihli dosyayi calisitirip guncel sonuclarin oldugu bugun dosyasini yaratiyorum, ancak hafta sonlarini hesaba katmadigim icin cmd dosyasi pazartesi gunu, gecen cuma'dan kalan dosyayi calistiramamakta. Komut dosyalari ile arasi iyi olan arkadaslarim, asagida ki komutu, ilgili klasorde ki en son tarihli dosyanin calismasini saglatabilir mi ? Tesekkurler. echo Today is %date% @echo off set day=-1 echo >"%temp%\%~n0.vbs" s=DateAdd("d",%day%,now) : d=weekday(s) echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^& right(100+month(s),2)^& right(100+day(s),2) for /f %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "result=%%a" del "%temp%\%~n0.vbs" set "YYYY=%result:~0,4%" set "MM=%result:~4,2%" set "DD=%result:~6,2%" set "data=%dd%.%mm%.%yyyy%" echo Yesterday was %data% cscript "C:\Users\PLHUTEK\OneDrive - ABB\aSCM\a\Bassware CH\run.vbs" "C:\Users\PLHUTEK\OneDrive - ABB\aSCM\a\Bassware CH\Bassware Results - %data%.xlsm" Edited April 23, 2019 by lontokyo Quote Link to comment Share on other sites More sharing options...
Hayaletx Posted April 23, 2019 Share Posted April 23, 2019 (edited) Aşağıdaki örnekden faydalanabilirsiniz , aşağıdaki örnek de arsiv klasörünün içindeki xlsx dosyaların dan en son değişeni ( en yeni dosya) alır adını veri.xlsx olarak değiştirip bat dosyasının bulunduğu dizine kopyalar ve çalıştırır. Örnek Dosyalar Please register to see this content. @echo off setlocal enableextensions disabledelayedexpansion set "source=arsiv" set "target=." FOR /F "delims=" %%I IN (' DIR "%source%\*.xlsx" /A-D /O-D /B ') DO COPY "%source%\%%I" "%target%\veri.xlsx" & echo %%I & GOTO :END :END start veri.xlsx Exit Edited April 23, 2019 by Hayaletx 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.