none
Como criar pasta via script na área de trabalho RRS feed

  • Pergunta

  • Pessoal,

    É o seguinte tenho o script de logon abaixo:

    ' Copyright (c) 2003-2010
    ' DATE  : 4/10/2003
    '
    ' COMMENT: Enumerates current users' group memberships in given domain.
    '          Maps and disconnects drives and printers
    '
    '==========================================================================


    ON ERROR RESUME NEXT

    Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path


    Set WSHShell = CreateObject("WScript.Shell")
    Set WSHNetwork = CreateObject("WScript.Network")
    'Automatically grab the user's domain name
    DomainString = Wshnetwork.UserDomain
    'Find the Windows Directory
    WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")

    'Grab the user name
    UserString = WSHNetwork.UserName
    'Bind to the user object to get user name and check for group memberships later
    Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

    'Grab the computer name for use in add-on code later
    strComputer = WSHNetwork.ComputerName

    'Disconnect ALL mapped drives
    Set clDrives = WshNetwork.EnumNetworkDrives
    For i = 0 to clDrives.Count -1 Step 2
        WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
    Next

    'Give the PC time to do the disconnect, wait 300 milliseconds
    wscript.sleep 300

    'Map drives needed by all
    'Note the first command uses the user name as a variable to map to a user share.
    'Note alternate mapping code in Add-In section that allows
    'friendly renaming of drive mappings

    'ATALHO PARA WORD NA AREA DE TRABALHO DO USUÁRIO

    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    set oShellLink = WshShell.CreateShortcut(strDesktop & "\WORD.lnk")
    oShellLink.TargetPath = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.WindowStyle = 1
    'oShellLink.Hotkey = "CTRL+SHIFT+F"
    oShellLink.Description = "WORD"
    oShellLink.WorkingDirectory = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.Save

    Basicamente o que esse script de logon faz é criar um atalho para o Word na área de trabalho do usuário OK?

    Então preciso do seguinte, um script de logon que crie uma pasta OFFICE e dentro dessa pasta eu tenha todos os atalhos ao Office: Word,Power Point e Excel...alguma sugestão?

    OBRIGADO.


    • Editado Curious_007 quinta-feira, 29 de março de 2012 13:01
    • Movido Paul Haro quinta-feira, 29 de março de 2012 13:37 Forum incorreto (De:Windows Server 2008)
    quinta-feira, 29 de março de 2012 13:00

Respostas

  • Adicionei o código que cria a pasta, agora vc tem só que adicionar os atalhos que vc quer. Basicamente vc só tem que pegar o último trecho de código ( deste comentário em diante '---- Repita este código para cada programa do Office que vc deseja) copiar no final do código e modificar alguns parametros (como target path).

    ' Copyright (c) 2003-2010
     ' DATE  : 4/10/2003
     '
     ' COMMENT: Enumerates current users' group memberships in given domain.
     '          Maps and disconnects drives and printers
     '
     '==========================================================================
     
    
    ON ERROR RESUME NEXT
     
    Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
     
    
    Set WSHShell = CreateObject("WScript.Shell")
    Set WSHNetwork = CreateObject("WScript.Network")
    'Automatically grab the user's domain name
    DomainString = Wshnetwork.UserDomain
    'Find the Windows Directory
    WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
     
    'Grab the user name
    UserString = WSHNetwork.UserName
    'Bind to the user object to get user name and check for group memberships later
    Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
     
    'Grab the computer name for use in add-on code later
    strComputer = WSHNetwork.ComputerName
     
    'Disconnect ALL mapped drives
    Set clDrives = WshNetwork.EnumNetworkDrives
    For i = 0 to clDrives.Count -1 Step 2
         WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
    Next
     
    'Give the PC time to do the disconnect, wait 300 milliseconds
    wscript.sleep 300
     
    'Map drives needed by all
     'Note the first command uses the user name as a variable to map to a user share.
     'Note alternate mapping code in Add-In section that allows
     'friendly renaming of drive mappings
     
    
     '========== MODIFIQUEI DAQUI EM DIANTE
     
    'Cria pasta Office no desktop
    on error resume next
    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    
    ParentFolder = strDesktop
    set objShell = CreateObject("Shell.Application")
    set objFolder = objShell.NameSpace(ParentFolder) 
    objFolder.NewFolder "OFFICE"
    
    
     '---- Repita este código para cada programa do Office que vc deseja
     'ATALHO PARA WORD NA AREA DE TRABALHO DO USUÁRIO
    set oShellLink = WshShell.CreateShortcut(strDesktop & "\OFFICE\WORD.lnk")
    oShellLink.TargetPath = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.WindowStyle = 1
    'oShellLink.Hotkey = "CTRL+SHIFT+F"
    oShellLink.Description = "WORD"
    oShellLink.WorkingDirectory = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.Save
    '---------------------------------------------------------------------------
    
    


    Fábio de Paula Junior

    quinta-feira, 29 de março de 2012 19:27
    Moderador

Todas as Respostas

  • Adicionei o código que cria a pasta, agora vc tem só que adicionar os atalhos que vc quer. Basicamente vc só tem que pegar o último trecho de código ( deste comentário em diante '---- Repita este código para cada programa do Office que vc deseja) copiar no final do código e modificar alguns parametros (como target path).

    ' Copyright (c) 2003-2010
     ' DATE  : 4/10/2003
     '
     ' COMMENT: Enumerates current users' group memberships in given domain.
     '          Maps and disconnects drives and printers
     '
     '==========================================================================
     
    
    ON ERROR RESUME NEXT
     
    Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
     
    
    Set WSHShell = CreateObject("WScript.Shell")
    Set WSHNetwork = CreateObject("WScript.Network")
    'Automatically grab the user's domain name
    DomainString = Wshnetwork.UserDomain
    'Find the Windows Directory
    WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
     
    'Grab the user name
    UserString = WSHNetwork.UserName
    'Bind to the user object to get user name and check for group memberships later
    Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
     
    'Grab the computer name for use in add-on code later
    strComputer = WSHNetwork.ComputerName
     
    'Disconnect ALL mapped drives
    Set clDrives = WshNetwork.EnumNetworkDrives
    For i = 0 to clDrives.Count -1 Step 2
         WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True
    Next
     
    'Give the PC time to do the disconnect, wait 300 milliseconds
    wscript.sleep 300
     
    'Map drives needed by all
     'Note the first command uses the user name as a variable to map to a user share.
     'Note alternate mapping code in Add-In section that allows
     'friendly renaming of drive mappings
     
    
     '========== MODIFIQUEI DAQUI EM DIANTE
     
    'Cria pasta Office no desktop
    on error resume next
    set WshShell = WScript.CreateObject("WScript.Shell")
    strDesktop = WshShell.SpecialFolders("Desktop")
    
    ParentFolder = strDesktop
    set objShell = CreateObject("Shell.Application")
    set objFolder = objShell.NameSpace(ParentFolder) 
    objFolder.NewFolder "OFFICE"
    
    
     '---- Repita este código para cada programa do Office que vc deseja
     'ATALHO PARA WORD NA AREA DE TRABALHO DO USUÁRIO
    set oShellLink = WshShell.CreateShortcut(strDesktop & "\OFFICE\WORD.lnk")
    oShellLink.TargetPath = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.WindowStyle = 1
    'oShellLink.Hotkey = "CTRL+SHIFT+F"
    oShellLink.Description = "WORD"
    oShellLink.WorkingDirectory = "C:\Program Files\Microsoft Office\Office14\winword.exe"
    oShellLink.Save
    '---------------------------------------------------------------------------
    
    


    Fábio de Paula Junior

    quinta-feira, 29 de março de 2012 19:27
    Moderador
  • Obrigado pela ajuda, vou homologar amanhã e confirmo se deu certo...Valeu d+.
    quinta-feira, 29 de março de 2012 21:37