Jump to content

run once logon script in windows xp- solved


Recommended Posts

hey, its rami, and i am breaking my head on that, but still cant find a solution:

i have windows xp pro,

and i want the logon script -thru Group Policy- will run just at once and not after etc logon.

how can i do that?

EDIT:

====

in search i was found that:

if not exist %systemroot%\nameofile.txt (
some commands
another command
more commands
) > %systemroot%\nameofile.txt

which needed to be in the a batch file at logon script at Group Policy.

found here.

what it means:

some commands
another command
more commands

?

EDIT:

====

solved.

i was put an example batch test file which include the lines:

if not exist %SYSTEMDRIVE%\text.txt (
copy f:\test.txt c:\test.txt
) > %SYSTEMDRIVE%\test.txt

which search if the file test.txt is not found on c:\.

if its found he does nothing.

if its not found it preform a copying command from to the text.txt file from f:\ to c:\

Edited by RAMI7250
Link to comment
Share on other sites

  • 1 year later...

I've found a nifty way of creating a logon script that appends a line of text (or however many lines) to a pre-existing file (i.e. services file in etc folder)

This can be put into the logon folder of a GPO to ensure the line is appended once only on logon, and never again

@ echo off

SETLOCAL ENABLEDELAYEDEXPANSION

IF EXIST "c:\done.txt" (
goto exit
) ELSE (

echo test test test 1 2 3 4 5 >> c:\test.txt
)


(
echo done > c:\done.txt
)


:exit

This will check for the "done.txt: file, if its not there, it will add the desired text to the required file, then drop a file to say its done.

On next logon, the logon script exits as it finds the check file

Easy as pie... If anyone has an easier way to do this please let me know

Thanks

Note the c:\test.txt should already exist

Edited by delnic
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...