Note that there are some explanatory texts on larger screens.

plurals
  1. POBatch file will not run on XP only Windows 7
    primarykey
    data
    text
    <p>I am pulling my hair out! This batch file runs just fine on my windows seven laptop but when i try to run it from a windows 2003 server or an xp computer parts of it don't work. The script is below, the part that does not work on XP is:</p> <pre><code>rem check if it's sunday or not IF NOT %Sunday%==%TODAY% ( chdir "C:\e-edition_upload\tecnavia-archives" setlocal EnableDelayedExpansion for %%f in (*%Sun_Find%*.pdf) do ( set "filename=%%f" if "!filename:~4,4!" equ "%Sun_Find%" move "%%f" "C:\e-edition_upload\sunday" ) ) rem check if it's monday or not IF NOT %Monday%==%TODAY% ( chdir "C:\e-edition_upload\tecnavia-archives" setlocal EnableDelayedExpansion for %%f in (*%Mon_Find%*.pdf) do ( set "filename=%%f" if "!filename:~4,4!" equ "%Mon_Find%" move "%%f" "C:\e-edition_upload\monday" ) ) </code></pre> <p>I am at a total loss here and this needs to be fixed asap because my butt is on the line. H</p> <p>Here is the full code:</p> <pre><code>@echo on for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b set year=%year:~-2% set TODAY=%month%%day%%year% rem find the date of the next monday &gt;NextMon.vbs echo NextMonday=FormatDateTime(Date+(9-Weekday(Date))) &gt;&gt;NextMon.vbs echo SY=Year(NextMonday) &gt;&gt;NextMon.vbs echo SM=Month(NextMonday) &gt;&gt;NextMon.vbs echo SD=Day(NextMonday) &gt;&gt;NextMon.vbs echo wscript.echo SY ^&amp; "," ^&amp; SM ^&amp; "," ^&amp; SD For /f "tokens=1-3 delims=," %%A in ('cscript //nologo NextMon.vbs') do ( Set mon_yyyy=%%A Set mon_mm=%%B Set mon_dd=%%C ) del NextMon.vbs If %mon_mm% lss 10 Set mon_mm=0%mon_mm% If %mon_dd% lss 10 Set mon_dd=0%mon_dd% Set mon_Year=%mon_yyyy:~-2% Set Monday=%mon_mm%%mon_dd%%mon_Year% rem find the date of the next sunday &gt;NextSun.vbs echo NextSunday=FormatDateTime(Date+(8-Weekday(Date))) &gt;&gt;NextSun.vbs echo SY=Year(NextSunday) &gt;&gt;NextSun.vbs echo SM=Month(NextSunday) &gt;&gt;NextSun.vbs echo SD=Day(NextSunday) &gt;&gt;NextSun.vbs echo wscript.echo SY ^&amp; "," ^&amp; SM ^&amp; "," ^&amp; SD For /f "tokens=1-3 delims=," %%A in ('cscript //nologo NextSun.vbs') do ( Set sun_yyyy=%%A Set sun_mm=%%B Set sun_dd=%%C ) del NextSun.vbs If %sun_mm% lss 10 Set sun_mm=0%sun_mm% If %sun_dd% lss 10 Set sun_dd=0%sun_dd% Set Sun_Year=%sun_yyyy:~-2% Set Sunday=%sun_mm%%sun_dd%%Sun_Year% Set Sun_Find=%sun_mm%%sun_dd% Set Mon_Find=%mon_mm%%mon_dd% rem check if it's sunday or not IF NOT %Sunday%==%TODAY% ( chdir "C:\e-edition_upload\tecnavia-archives" setlocal EnableDelayedExpansion for %%f in (*%Sun_Find%*.pdf) do ( set "filename=%%f" if "!filename:~4,4!" equ "%Sun_Find%" move "%%f" "C:\e-edition_upload\sunday" ) ) rem check if it's monday or not IF NOT %Monday%==%TODAY% ( chdir "C:\e-edition_upload\tecnavia-archives" setlocal EnableDelayedExpansion for %%f in (*%Mon_Find%*.pdf) do ( set "filename=%%f" if "!filename:~4,4!" equ "%Mon_Find%" move "%%f" "C:\e-edition_upload\monday" ) ) md "C:\e-edition_upload\newsbank\%TODAY%" xcopy /s "C:\e-edition_upload\tecnavia-archives" "C:\e-edition_upload\newsbank\%TODAY%" pause </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload