linux => windows script translation

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!
 
G

Guest

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).***
 
D

David Candy

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.
 
D

David Candy

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
 
P

Piotrek G.

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top