PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > Shortcut on desktop via logon?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Shortcut on desktop via logon?

Réponse
 
LinkBack Outils de la discussion
Vieux 02/10/2008, 22h59   #1
Linn Kubler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Shortcut on desktop via logon?

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


  Réponse avec citation
Vieux 02/10/2008, 23h31   #2
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
> 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
>


Since the string
%ALLUSERSPROFILE%\Desktop\PI.lnk
contains embedded spaces when resolved, you must surround the whole lot with
double quotes:
"%ALLUSERSPROFILE%\Desktop\PI.lnk"
You must also provide the full path (share + folder name) for your source
file pi.lnk.


  Réponse avec citation
Vieux 02/10/2008, 23h33   #3
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
> 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.


  Réponse avec citation
Vieux 03/10/2008, 05h53   #4
Al Dunbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>
> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>> 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


  Réponse avec citation
Vieux 03/10/2008, 08h30   #5
Pegasus \(MVP\)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Al Dunbar" <AlanDrub@hotmail.com.nospaam> wrote in message
news:et59ouQJJHA.740@TK2MSFTNGP03.phx.gbl...
>
> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
> news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>>
>> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
>> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>>> 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?


  Réponse avec citation
Vieux 03/10/2008, 15h33   #6
Linn Kubler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:eak4FGSJJHA.4672@TK2MSFTNGP05.phx.gbl...
>
> "Al Dunbar" <AlanDrub@hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740@TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>>>> 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?


Thanks guys for the suggestions, I like this method for it's simplicity.
I've never had to do so much with batch files that I needed learned all
these tricks. Hard part here will be creating the complist.txt of computer
names and making sure they are all on.

It did occure to me last night that I don't need it in the logon script. If
I put the shortcut on the all users desktop then most users won't be able to
delete it and it should remain there. Let me give this a try.

Thanks,
Linn


  Réponse avec citation
Vieux 03/10/2008, 19h04   #7
Linn Kubler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:eak4FGSJJHA.4672@TK2MSFTNGP05.phx.gbl...
>
> "Al Dunbar" <AlanDrub@hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740@TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>>>> 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


  Réponse avec citation
Vieux 03/10/2008, 19h16   #8
Linn Kubler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:%23OTKLoXJJHA.4996@TK2MSFTNGP03.phx.gbl...
>
> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
> news:eak4FGSJJHA.4672@TK2MSFTNGP05.phx.gbl...
>>
>> "Al Dunbar" <AlanDrub@hotmail.com.nospaam> wrote in message
>> news:et59ouQJJHA.740@TK2MSFTNGP03.phx.gbl...
>>>
>>> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
>>> news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>>>>
>>>> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
>>>> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>>>>> 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


  Réponse avec citation
Vieux 07/10/2008, 02h22   #9
Al Dunbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Shortcut on desktop via logon?


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:eak4FGSJJHA.4672@TK2MSFTNGP05.phx.gbl...
>
> "Al Dunbar" <AlanDrub@hotmail.com.nospaam> wrote in message
> news:et59ouQJJHA.740@TK2MSFTNGP03.phx.gbl...
>>
>> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
>> news:OXfTGaNJJHA.5356@TK2MSFTNGP05.phx.gbl...
>>>
>>> "Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
>>> news:OzCi$GNJJHA.4280@TK2MSFTNGP04.phx.gbl...
>>>> 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?


I was in a hurry. But I didn't say "use this", I said that "I find it more
straightforward ... with something _LIKE_ this".

/Al


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h11.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,27934 seconds with 17 queries