Question:
Dos command "CD foldername.lnk" give error "The Directory name is invalid"?
iMADDawg
2006-10-29 16:02:25 UTC
It appears you can not "cd" to a lnk file. Using WinXP I copied a folder and pasted the shorcut. As a path name my shortcut would be represened as "C:\foldername.lnk". If I go to a DOS prompt "C:\" and try the command "cd foldername.lnk" i get the error message "The Directory name is invalid". I can cd to other non-linked directories. Does the "CD" command not work with "*.lnk" files (shortcut links)?
Three answers:
Myke BoDean
2006-10-29 19:18:33 UTC
The i-node table structure in Windows XP incorporates new field and file attributes which are not backwards compatible with legacy command interpreters such as that offered by the DOS command prompt. The "CD" command attempts to query the directory attribute only but subsequent revisions of compatible shells know to query the symbolic link n-node immediately after any failed function call to the legacy directory fields - thus providing the extended functionality of enabling directory recursion across a secondary link.
piquet
2006-10-30 00:17:35 UTC
no, *.lnk files are just that - they're files not folders.



in windows when you click them they go to the folder they're a shortcut to because it's a windows feature that's built in.



in dos they're just plain files, so using change directory always fails because you're trying to change directory to a file not a folder.
=Jimmy=
2006-10-30 00:19:16 UTC
here is how you do. Instead of putting ".ink" just put * like this



foldername* it works like a charm.



try this

C:\>copy foldername* d:\

foldername.lnk

1 file(s) copied.



And also filename ends with .ink you can not do a cd command because it is not a directory or folder. it is just a file. You can either run or copy and stuff.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...