Re: ShortCut in desktop through Logon Script
- From: Luiz <Luiz@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 09:54:01 -0800
Thank you Harvey.
Best Regards.
Luiz
"Harvey Colwell" wrote:
I agree that the simplest method is often the best. But there are times that.
you may want something more elaborate, such as, built-in error checking.
Here's a generic "Push to Desktop" script I wrote a while back. I use it
within login scripts, but it can be ran as a standalone. Just pass it the
full path of the file you want to push out as the first command line
parameter. i.e.
cscript //nologo "Push To Desktop.vbs"
"\\servername\NETLOGON\URL\my_shortcut.lnk"
Line 26 is the vbScript equivalent to the DOS "copy" command.
NOTE: Each line of the script is numbered. If any is not, it was wrapped by
your email client. Append any such lines to the line directly above them
then remove the line numbers.
[--- Begin: Push to Desktop.VBS ---]
001. ' Windows Script Host - VBScript
002. '---------------------------------------------------------
003. ' Name: Push To Desktop.VBS
004. ' By: Harvey Colwell
005. ' Version: 1.0
006. ' CopyRight: (c) Apr 2002, All Rights Reserved!
007. '
008. '*********************************************************
009. Option Explicit
010.
011. Dim oWS, oFS
012.
013. Set oWS = WScript.CreateObject("WScript.Shell")
014. Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
015.
016. Dim bDebug, sFile, sDest
017.
018. bDebug = FALSE
019.
020. If Not WSCript.Arguments.Count < 1 Then
021. sFile = WSCript.Arguments(0)
022. sDest = oWS.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop\"
023.
024. If IsFile(sFile) Then
025. If IsFolder(sDest) Then
026. oFS.CopyFile sFile, sDest, True
027. Else
028. ShowMsg "The All User Desktop Could not be found!" & vbCrLf & sFIle
029. End If
030. Else
031. ShowMsg "The specified file does not exist!" & vbCrLf & sFIle
032. End If
033.
034. Else
035. ShowMsg "No file was specified on the command line!"
036. End If
037.
038. Set oWS = Nothing
039. Set oFS = Nothing
040. WScript.Quit
041.
042. '---------------------
043. Sub ShowMsg(sMsg)
044. If bDebug Then MsgBox "ERROR: " & sMsg, vbInformation, "Debug Message"
045. End Sub
046.
047. '---------------------
048. Function IsFolder(fName)
049. If oFS.FolderExists(fName) Then IsFolder = True Else IsFolder = False
050. End Function
051.
052. '---------------------
053. Function IsFile(fName)
054. If oFS.FileExists(fName) Then IsFile = True Else IsFile = False
055. End Function
[--- End: Push to Desktop.VBS ---]
- References:
- Re: ShortCut in desktop through Logon Script
- From: Pegasus \(MVP\)
- Re: ShortCut in desktop through Logon Script
- From: Harvey Colwell
- Re: ShortCut in desktop through Logon Script
- Prev by Date: Re: vbscript to find largest directory ?
- Next by Date: Re: vbs and ldap - sub ou?
- Previous by thread: Re: ShortCut in desktop through Logon Script
- Next by thread: WORKGROUP user password change help needed
- Index(es):
Relevant Pages
|