|
|
|||||||
We moved from standard \\server\share\file to a DFS path. Does kixscript copy command understand DFS paths? I get error2 when I try to copy a file from the DFS path. There is spaces in the path but I'm using quotes. copy "\\domain.com\path\folder\is\public\Telnet client.lnk" c:\user\user1\desktop\ If @ERROR <> 0 "Error @ERROR file copy " in the full script I'm reading the registry to get the users desktop location. But for trouble shooting I'm hardcoding it right now. |
||||||||
|
|
|||||||
Up front... I have no experience with DFS, but @error 2 is "The system cannot find the file specified." I would start by trying to do the copy in the CMD shell first and make sure your paths are correct or something like Code: if exist("\\domain.com\path\folder\is\public\Telnet client.lnk") ? "it's there" endif If you do a simple search of the board for DFS you will see a few posts that have been made over the years. |
||||||||
|
|
|||||||
Copying a file from a DFS share works just fine. Code: Break on Copy "\\Domain\DFSFolder\new text document.txt" "c:\users\Username\desktop\" If @ERROR <> 0 ? @ERROR ? @SERROR EndIf Sleep 5 Most likely the .lnk is causing an issue but this is also not DFS related. I had this happening before and switched to the WHSShortcut() UDF. This creates a shortcut for you to the file or application you need. In my experience copying a shortcut is a pain in the ..... so I avoid it and just use WSHShortcut() to do the work. If you have never used a UDF before: How to use a UDF Code: Break on $rc = wshShortCut("Telnet client", "\\domain\folder\Telnet client.exe",,, "D:\icons\SomeIcon.ico",,) ? $rc ? @ERROR ? @SERROR Sleep 10 ;======== BELOW IS A UDF. THEY COME READY FOR USE ======== ;======== NO CHANGES TO THE CODE BELOW SHOULD BE REQUIRED ======== ; ; wshShortCut() ; ;Authors and Contributors: ; Shawn, Radimus, Al_Po, ; Richard Farthing, NTDOC ; ;Version: ; 1.3.4 ; ;Action: ; Creates Shortcuts for files or Web pages ; ;Syntax: ; wshShortCut($shortcutname,$targetpath,optional $arguments, optional $startdir, optional $iconpath, optional $style, optional $Description) ; ;Parameters: ; SHORTCUTNAME Required. Name of Shortcut. If path is omitted, will be saved to desktop. ; TARGETPATH Required. The path the target point to. To ommit checking if path exists in the function, append the target path ; with ",1" ; ARGUMENTS Optional. Arguments appended to TARGETPATH ; STARTDIR Optional. Working Directory ; ICONPATH Optional. Path to Icon Library. To specify an icon other than the first, separate the icon path with ; ",#" where # represents the icon in the library. ; STYLE Optional. 1 = default, 3 = maximized window, 7 = minimized window ; DESCRIPTION Optional. Description or Comment about Shortcut ; HOTKEY Optional. Keyboard Hotkey. (Note: Shortcut must be saved to desktop or startmenu for Hotkey to function) ; ;Remarks: ; wshShortCut 1.3.4 ; - Dimmed undimmed var ; wshShortCut 1.3.3 ; - Added option to bypass TARGETPATH exist check on LNK shortcuts. Add ,1 to the end of your Targetpath to bypass ; See Example below. ; wshShortCut 1.3.2 ; - Included Option for HotKey(.hotkey) ; wshShortCut 1.3.1 ; - Bug Fixes when creating URL shortcuts ; wshShortCut 1.3 ; - Attempts to create directory structure to shortcut if it does not exist ; wshShortcut 1.2: ; - Support for NoVarsinStrings ; - Checks for existence of TargetPath in .lnk files ; - Included option for Description (.description) ; wshShortcut 1.1: ; - fixes a logic bug in wshShortCut 1.0 so you can use more than icons 0-9 in a icon library on URLS. ; - Unless path is explicity stated in $ShortCutName, icons are created on the desktop ; - If .lnk or .url is omitted, UDF tries to determine the shortcut type, but defaults to .lnk if it can't figure it out. ; wshShortCut 1.0 ; http://www.kixtart.org/ubbthreads/showfl...=true#Post81769 ; ;Examples: ; $=wshShortcut("KiXtart Web Page","http://www.kixtart.org") ; $=wshShortcut("Notepad","%systemroot%\system32\notepad.exe") ; $=wshShortcut$=wshshortcut("Server1","\\Server1,1") Function wshShortCut($shortcutname, $targetpath, optional $arguments, optional $startdir, optional $iconpath, optional $style, optional $description, optional $hotkey) Dim $shell, $desktop, $shortcut, $index, $iconinfo, $iconindex, $scdir, $rc $wshshortcut = 1 $shell = CreateObject("wscript.shell") If $shell If UCase(Right($shortcutname, 4)) = ".URL" Or UCase(Right($shortcutname, 4)) = ".LNK" ;do nothing Else If UCase(Left($targetpath, 5)) = "HTTP:" Or UCase(Left($targetpath, 6)) = "HTTPS:" Or UCase(Left($targetpath, 4)) = "FTP:" $shortcutname = $shortcutname + ".url" Else $shortcutname = $shortcutname + ".lnk" EndIf EndIf If InStr($targetpath, ",") $targetpath = Split($targetpath, ",")[0] Else If InStr($shortcutname, ".lnk") And Not Exist($targetpath) Exit 2 EndIf EndIf If InStr($shortcutname, "\") = 0 $Desktop = $shell.SpecialFolders("Desktop") $shortcutname = $desktop + "\" + $shortcutname Else $scdir = SubStr($shortcutname, 1, InStrRev($shortcutname, "\")) If Not Exist($scdir) MD $scdir If @error Exit @error EndIf EndIf EndIf $shortcut = $shell.createshortcut($shortcutname) If $shortcut $shortcut.targetpath = $targetpath If $iconpath And InStrRev($shortcutname, ".lnk") $shortcut.iconlocation = $iconpath EndIf If $arguments $shortcut.arguments = $arguments EndIf If $startdir $shortcut.workingdirectory = $startdir EndIf If $style $shortcut.windowstyle = $style EndIf If $description And InStrRev($shortcutname, ".lnk") $shortcut.description = $description EndIf If $hotkey $shortcut.hotkey = $hotkey EndIf $shortcut.save If @error Exit @error EndIf If InStrRev($shortcutname, ".url") And $iconpath $index = InStrRev($iconpath, ",") If $index = 0 $iconindex = 0 Else $iconindex = Split($iconpath, ",")[1] $iconpath = Split($iconpath, ",")[0] EndIf $rc = WriteProfileString($shortcutname, "InternetShortcut", "IconFile", $iconpath) $rc = WriteProfileString($shortcutname, "InternetShortcut", "IconIndex", $iconindex) EndIf $shortcut = 0 $wshshortcut = 0 Else Exit @error EndIf Else Exit @error EndIf EndFunction |
||||||||
|
|
|||||||
When we deploy shortcuts (.lnk or .url), we always add a .TXT suffix when we place them on the source share. Then, we COPY "Shortcut.lnk.TXT dest\Shortcut.lnk" - this seems to work much better than trying to copy the links directly. Glenn |