Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a batch file that makes a directory on H:\ and copies all of my CS work from I:\ to H:\ ( our I:\ drive isn't always available ). Is there a way to possibly run this batch file on logoff so that my files are always updated, WITHOUT using gpedit.msc (access denied)?

I am on a student computer, so most likely installing software won't to practical, but I could try. And help would be much appreciated =)

Or is there a way to run a batch file, and not have the commands run until like.. 8:50 before the bell rings, so I could just put it in the Startup folder and it could run at that time?

I thought about it some more, and the easiest way would be to set a scheduled task at 8:50 for it to run.. but it would still be nice if I knew how to to do in a batch file. I don't have access to the shutdown -l commands, and I don't believe that would help anyways because I want the script to run when I click 'Log Off'.

share|improve this question

5 Answers 5

This should do the trick. Save as a REG file and import, unless that is blocked as well. This effectively creates a logoff script entry.

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="H:\your-script-here.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00 ,00,00,00,00,00

Save your script to do the copy under the root of your H: drive.

share|improve this answer

you can put that line at the end of your batch file

shutdown -l

this will log you off as soon as the script is done

share|improve this answer
    
I know this is a late comment, but I didn't use this command because A) I don't have the access rights and b) I wouldn't want another user in the next class period to use my computer if it were to take longer than usual –  ekaj Mar 25 '12 at 3:53

I'm not sure which version of Windows added this program, but you could use the waitfor command to pause a batch file for 3,000 seconds (i.e. 50 minutes), then continue with your copy command.

It's definitely available in Windows 7, almost certainly in Vista, and not in XP. However, it may be available in the Windows 2003 Resource Kit Utilities that are available to download, which will run on XP.

There's probably some batch trickery that's possible to pause a script for a particular amount of time too.

share|improve this answer
up vote 0 down vote accepted

I eventually just used Scheduled Tasks and set the batch file to run at 8:50, that should work.

share|improve this answer

Start -> Run and type "gpedit.msc"

Under User Configuration -> Windows Settings -> Scripts (Logon/Logoff) you can add your scripts

share|improve this answer
    
The OP explicitly stated that access to gpedit.msc was denied. –  afrazier Oct 11 '11 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.