1
vote
2answers
1k views

Delete all files older than 365 days, but exclude certain folders

Edit: After @Mbu answer I realized that my first approach with leading numbers in folders as criteria to exclude isn't the right way. I decided to use a fixed list of folders to exclude. I want to ...
0
votes
1answer
847 views

FORFILES not deleting files in subdirectory

Below is my forfiles one-liner: FORFILES /P "X:\LOGS\HS" /S /M *.log /D -1 /C "CMD /C del /Q @FILE"qq ~q Although I have the /S option to delete log files in X:\LOGS\HS, there are several ...
1
vote
1answer
812 views

Run windows batch file from ssh login - env vars missing

I am trying to run a windows batch file from a ssh login. I have successfully installed cygwin w/ OpenSSH on the server (windows 2003). I can log in and run the file, but the file does not run ...
0
votes
1answer
525 views

Schtasks can't run .bat file in windows server 2003

I have a problem with running a .bat file in windows 2003. If I change the user to Admin, I can run it without any problem, but with SYSTEM as user, it will not run. The command is: SCHTASKS /Create ...
4
votes
4answers
3k views

Run a batch file before user logs into Windows 2003 R2?

I have an Amazon EC2 machine (Windows Server 2003 R2) where I want to run a script (.bat file) when the Windows Server 2003 R2 machine boots up. This need to run BEFORE any user logs in. Ideally I'd ...
3
votes
1answer
584 views

Windows Dos/Batch File Books

I recently moved to a new company that uses Windows batch files left, right and center. Is there a definitive book of writing / using batch scripts out there? It's mostly Windows XP and Server 2003 ...
4
votes
5answers
12k views

Batch file to replace a single character in Windows filenames

I have a Windows Server 2003 server that has a whole bunch of filenames that need renaming. Basically, I just need all - (hyphens) replaced with _ (underscores), no matter where they are in the ...