Help - Search - Members - Calendar
Full Version: run once logon script in windows xp- solved
MSFN Forums > Coding, Scripting and Servers > Programming (C++, Delphi, VB, etc.)

   


Google Internet Forums Unattended CD/DVD Guide
RAMI7250
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:

CODE
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:

CODE
some commands
another command
more commands


?

EDIT:
====

solved.

i was put an example batch test file which include the lines:
CODE
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:\
delnic
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

CODE
@ 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




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.