5 Mar 2011 at 1:31 AM, David Lum <[email protected]> wrote: > Is there a better way to do this via login script while still using batch > (read: not VBS or PS)? Specifically avoid the drive mapping stuff. I have > tried variations on %0\..\ but I can't qiute get it to work as itbarfs on > the IF statement. I could copy the file placeholder file instead of creating > it on the fly, but then it doesn't like to run %0\..\usefulexecuable.exe > > And yes I know this script is making everyone map to the same DC, another > reason I'd like to do it sans drive mapping. > ------------------ > @echo off > net use B: \\MyDC\netlogon > b: > If exist "%USERPROFILE%\My Documents\Outlookplaceholder.cmd" goto alreadydone > echo @echo off > "%USERPROFILE%\My Documents\Outlookplaceholder.cmd" > echo echo Placeholder for outlook Migration, do not delete >> > "%USERPROFILE%\My > Documents\Outlookplaceholder.cmd" > echo pause >> "%USERPROFILE%\My Documents\Outlookplaceholder.cmd" > attrib +r "%USERPROFILE%\My Documents\Outlookplaceholder.cmd" > b:\usefulexecutable.exe > :alreadydone > net use B: /del /y > exit
How about this: @echo off set FlagFile="%USERPROFILE%\Outlookplaceholder.cmd" If exist %FlagFile% goto alreadydone echo @echo off >%FlagFile% echo echo Placeholder for outlook Migration, do not delete >>%FlagFile% echo pause >>%FlagFile% attrib +r %FlagFile% set FlagFile= copy \\MyDC\netlogon\usefulexecutable.exe %temp% start /wait %temp%\usefulexecutable.exe del %temp%\usefulexecutable.exe :alreadydone exit -- Angus Scott-Fleming GeoApps, Tucson, Arizona 1-520-895-3270 Security Blog: http://geoapps.com/ ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to [email protected] with the body: unsubscribe ntsysadmin
