| 1. |
Solve : Copy from current path?? |
|
Answer» Hello everyone. I am trying to include some lines in a bat that will copy files from the current location to a specified path on a drive. Hello everyone. I am trying to include some lines in a bat that will copy files from the current location to a specified path on a drive.First off, you need to do a bit of registry modding for that script to work on a computer...LNK files are hidden, and you can only unhide them by deleting a certain registry. Batch can't see them unless you do it... If you want to move files which are in the current directory, just use their names and EXTENSIONS.Oh...wow i feel like a newb again. I knew there was a registry bit, but i ran that on my PC a while back. Or are you referring to running the registry change on the server? i chaged the path to just the filename and extension and tried running the bat and the following is what i get. Quote '\\server\infotech\test'Quote from: TheHoFL on June 02, 2009, 04:32:35 PM Oh...wow i feel like a newb again. I knew there was a registry bit, but i ran that on my PC a while back. Or are you referring to running the registry change on the server?On any computer that the batch file will be run on, the registry changes must be made.Okay, got it working. Below is my code that adds the registry that will allow running a bat from a UNC path. It worked perfectly. After running a BAT with the "REG" line should allow you to run any BAT from a UNC path. Code: [Select]Echo off REG ADD "HKCU\Software\Microsoft\Command Processor" /V DisableUNCCheck /T REG_DWORD /F /D 1 SET THISDIR=%~dp0 copy /Y "%THISDIR%Mitchell1.lnk" "%ALLUSERPROFILE%\desktop" copy /Y "%THISDIR%Gradebook.lnk" "%ALLUSERPROFILE%\desktop" echo The new files have been copied. pause Echo on Quote from: TheHoFL on June 02, 2009, 05:05:46 PM Okay, got it working. Below is my code that adds the registry that will allow running a bat from a UNC path. It worked perfectly. After running a BAT with the "REG" line should allow you to run any BAT from a UNC path.Ok... Two things. 1. Any computers that runit must have all instances of NeverShowEXT or they will get a file not found error...(Just so you know) 2. Why do you turn echo on at the end?Yeah i know. Only IT will be using this and we have our PCs setup CORRECTLY to use it. Thanks for the info though. Quote from: TheHoFL on June 02, 2009, 05:18:57 PM Yeah i know. Only IT will be using this and we have our PCs setup correctly to use it. Thanks for the info though.Ok and No problem! Quote First off, you need to do a bit of registry modding for that script to work on a computer...LNK files are hidden, and you can only unhide them by deleting a certain registry. Batch can't see them unless you do it... Not true... I can see LNK files in cmd with all my PCs. NeverShowExt applies to EXPLORER, not cmd. Same with the other "show hidden files", show extensions for known filetypes, etc etc. "LNK" files aren't "hidden" per se, but rather special shell files. usually around 400 to 600 bytes. Really, they evolved as a windows version of the older "PIF" files from windows 3.0/3.1. see here: HKEY_CLASSES_ROOT\.lnk aside from the keys here, refer also to: HKEY_CLASSES_ROOT\lnkfile which has the "NeverShowExt" option you mention. (which applies to explorer, and other applications which respect the option) I have it present, and I can see LNK files with dir. "editflags" sets the option so that the folder options dialog will not show LNK in the file associations list. (imagine the havoc if that association was accidentally deleted!) Which brings up an interesting point- there isn't really an association to anything for a shortcut- but rather an association to a particular Shell object, Likely a Shell interface object. My guess would be that the shell instantiates the object and de-serializes it's state from the shortcut's contents, and then the shell uses it's IFolderItem Interface to perform file-like tasks (most likely, execution) that in general operate on the target rather then the shortcut. However- anything to do with file associations is irrelevant when speaking of DIR or the command processor- it doesn't respect anything of the sort, and simply displays the files that are present. |
|