Search found 7 matches
- 26 Jan 2018 14:43
- Forum: DOS Batch Forum
- Topic: Variable not being set properly in a nested for loop
- Replies: 5
- Views: 3670
Re: Variable not being set properly in a nested for loop
As stated below, "I think that some of the parens would have been on the same line, but the file path I used was much longer and I replaced it for the purposes of this post." But if it will help C:\Users\psnider\Documents\Stuff\MISCELLANEOUS\ArchiveAurora>set themes=CDTNEW,C FTNEW C:\Users\psnider\D...
- 26 Jan 2018 13:15
- Forum: DOS Batch Forum
- Topic: Variable not being set properly in a nested for loop
- Replies: 5
- Views: 3670
Re: Variable not being set properly in a nested for loop
Thank you both! Unfortunately, the variable is still blank. I thought maybe if I sent the results that might help. Here is the updated code: @SETLOCAL ENABLEDELAYEDEXPANSION cls set themes=CDTNEW,CFTNEW for %%z in (%themes%) do ( set "Now=C:\Users\psnider\Documents\Stuff\MISCELLANEOUS\ArchiveAurora\...
- 25 Jan 2018 16:53
- Forum: DOS Batch Forum
- Topic: Variable not being set properly in a nested for loop
- Replies: 5
- Views: 3670
Variable not being set properly in a nested for loop
I have searched countless posts about this topic and changed the (!Now!) code many times based on what I have read ((%Now%) doesn't work at all), but the end result of using the following code is always that the myfiledateNow variable is blank. @SETLOCAL ENABLEDELAYEDEXPANSION set themes=CDTNEW,CFTN...
- 22 Jan 2018 09:05
- Forum: DOS Batch Forum
- Topic: Can't get a for loop to work in an if statement
- Replies: 3
- Views: 2890
Re: Can't get a for loop to work in an if statement
I used the quotes, but I am still getting the error "The syntax of the command is incorrect.". I should have been more specific before, apologies. @echo off @SETLOCAL ENABLEDELAYEDEXPANSION for %%a in (NewerFile.csv) do ( set myfiledateLast=%%~ta ) for %%a in (OlderFile.csv) do ( set myfiledateNow=%...
- 19 Jan 2018 14:43
- Forum: DOS Batch Forum
- Topic: Can't get a for loop to work in an if statement
- Replies: 3
- Views: 2890
Can't get a for loop to work in an if statement
I want to copy the contents of NewerFile to a log file if the time stamp of that file is different from OlderFile (this batch file will be run every 15 minutes, sometimes there are new files, sometimes not). I can get the following to work, but it's a waste of time to get the contents of the file on...
- 18 Jan 2018 08:34
- Forum: DOS Batch Forum
- Topic: Findstr on server results in "Specify only /L or /R."
- Replies: 2
- Views: 3230
Re: Findstr on server results in "Specify only /L or /R."
You were right, I wasn't doing it correctly before. I switched it to /V /G and it works correctly on both platforms now, thank you!
- 17 Jan 2018 17:03
- Forum: DOS Batch Forum
- Topic: Findstr on server results in "Specify only /L or /R."
- Replies: 2
- Views: 3230
Findstr on server results in "Specify only /L or /R."
I have been using this line on my machine (Windows 7 Pro version 6.1.7601) with success: findstr /vis:%File1% %File2% >> %LogFile%: This copies all the lines where there is no match between the two files into the log file. But when I loaded it on the Windows Server 2008 R2 Standard server (version 6...