linux => windows script translation

  • Thread starter Thread starter Piotrek G.
  • Start date Start date
P

Piotrek G.

Hi,
This is a simple linux command, which checks date and if it's Monday it
returns 'ok', otherwise it returns 'nok':

date |grep Mon && echo ok || echo nok

Could you please translate it into some windows script? It supposed to
be executed before user gets logged in. I think it should be quite easy
but I don't know windows scripting at all.
What's more, I'd like 'echo ok' (and 'echo nok') to be a windows command
(some 'net something...' command).

Thanks a lot!
 
This should do it :

if /i %date:~0,3%==mon (echo ok) else echo not ok

I did not understand this part:
***What's more, I'd like 'echo ok' (and 'echo nok') to be a windows command
(some 'net something...' command).***
 
Also

date /t | find "Monday" && Echo Ok || Echo NOk

You can even use grep if you install the resource kit. You could also read Help.

Note Date returns Mon not Monday if your regional settings are configured as standard.
 
Maybe he means

echo ok | time
(ok not a great use of ok but it demostrates that it works)

Or

time < c:\somefolder\SomeFileWithOkInIt.txt
 
David said:
Also

date /t | find "Monday" && Echo Ok || Echo NOk
^^^^
This is almost good but 'date /t' returns only date... I mean without
week day's name (only '2005-10-26').
You can even use grep if you install the resource kit. You could also read Help.
I don't want to change anything in this Windows. It's my girlfriend's (Anna)
computer, I don't want to complicate anything. I'm convinced that Windows can
manage with such a simple problem without any resource kits. I don't
want change her's Windows into POSIX platform. Windows is a good system
itself - no patches needed, I think.
Note Date returns Mon not Monday if your regional settings are configured as standard.
As I said date command does not return week day's name.

Reading help I've found other solution of my problem: 'net user /times'
- it's more than I expected :).

And what it is all about? Anna's younger sister plays too much Sims 2 :),
and we want to limit it a bit.

Thanks a lot for your help!
 
Back
Top