Good Day Al
I have the following batch script that loops through a folder containing .sql files. When it finds a .sql file that has today's date timestamp on it, it copies that file to a new directory.
@echo off
setlocal enableextensions enabledelayedexpansion
set "currentDate=%date:~0,10%"
for %%g in ("c:\mfa\*.sql") do (
set "fileDate=%%~tg"
set "fileDate=!fileDate:~0,10!"
if "!fileDate!"=="%currentDate%" (
copy "%%~fg" "c:\newLocation"
)
)
My PROBLEM:
This works great on Windows 7, but not on Windows Server 2008. When I echo the filedate variable on Win7, it gives me the timestamp saved in the !fileDate! value. But when I echo !fileDate! in Windows Server 2008, it returns: ECHO is off.
This still does not work even if I remove delayedexpansion.
Why is it not working on Server 2008?
==================== UPDATE -
Powershell Error
The term 'test.ps1' is not recognized as the name of a cmdlet, function, script file, or operable pro
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ test.ps1 <<<<
+ CategoryInfo : ObjectNotFound: (test.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException