"Linn Kubler" <> wrote in message
news:%...
>
> "Pegasus (MVP)" <> wrote in message
> news:...
>>
>> "Al Dunbar" <> wrote in message
>> news:...
>>>
>>> "Pegasus (MVP)" <> wrote in message
>>> news:...
>>>>
>>>> "Linn Kubler" <> wrote in message
>>>> news:OzCi$...
>>>>> Hi,
>>>>>
>>>>> I've been asked to distribute a shortcut to a web site to all my
>>>>> users. I think the best way to do this is through the logon.bat file,
>>>>> however, I'm stuck, can't seem to figure it out. It seemed simple
>>>>> enough, just add the following code to my batch file, right?
>>>>>
>>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\PI.lnk (Copy PI.lnk
>>>>> %ALLUSERSPROFILE%\Desktop)
>>>>>
>>>>> Of course this doesn't work. Can someone show me how to handle this
>>>>> in the simplest way possible? I've been Googling the solution and I'm
>>>>> not finding anything useful, just confusing.
>>>>>
>>>>> The PI.lnk file is currently located in the DC Netlogon directory.
>>>>>
>>>>> As a test I modified the line to look like this below and put a
>>>>> test.txt file on the All Users Desktop on my test system.
>>>>>
>>>>> If Not Exist %ALLUSERSPROFILE%\Desktop\test.txt (Echo "It's not
>>>>> there!") Else (Echo "It's there!")
>>>>>
>>>>> From this line I get no response in my batch file output. I'm clearly
>>>>> missing something fundamental here. Any thoughts, words of wisdom?
>>>>>
>>>>> Thanks in advance,
>>>>> Linn
>>>>>
>>>>
>>>> At second thoughts: Instead of writing "if not exist . . .", use
>>>> xcopy.exe with the /d switch. This method will copy the file if it does
>>>> not exist but also if the source file is newer than the target file.
>>>
>>> And finally - all of your users administrators or power users on the
>>> workstations? If not, the script will be unable to succeed as the logon
>>> script runs under the user's credentials.
>>>
>>> Personally, I'd find it more straightforward to push the file out to all
>>> the workstations while logged in to an account that is an admin on all
>>> the workstations with something like this:
>>>
>>> for /f %%C in (complist.txt) do (
>>> copy PI.lnk \\%%C\c$\Documents and Settings\All Users\Desktop
>>> )
>>>
>>> where the complist.txt file contains a list of the computers to be
>>> updated.
>>>
>>> /Al
>>>
>>
>> Didn't you forget a set of double-quotes there? And perhaps a /y switch
>> in order to avoid repeated "overwrite" prompts?
>
> Say, if I wanted to output the computer name and the result of the copy to
> a log file, how would I display the computer name?
>
> I tried adding the line; Echo %%c >> mylog.log but it just records %c.
>
> Thanks,
> Linn
Oops, never mind. I just realized it's case sensitive.
Linn
|