MSFN Forum: run once logon script in windows xp- solved - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

run once logon script in windows xp- solved Rate Topic: -----

#1 User is offline   RAMI7250 

  • Newbie
  • Group: Members
  • Posts: 48
  • Joined: 05-April 05

Posted 01 August 2008 - 08:15 AM

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

This post has been edited by RAMI7250: 01 August 2008 - 08:49 AM



#2 User is offline   delnic 

  • Group: Members
  • Posts: 1
  • Joined: 02-November 09

Posted 02 November 2009 - 09:26 PM

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

This post has been edited by delnic: 02 November 2009 - 09:28 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy