luke77 Posted December 11, 2010 Share Posted December 11, 2010 On a Vista SystemI have this batch file on a thumb drive.It works fine in a cmd.exe window, but not when executed from explorer.exe.Does someone know how to make it work?Vielen dank, Andyc:cd\cd Z0AA7~1That dir /x is handy as a pocket. :-) Link to comment Share on other sites More sharing options...
jaclaz Posted December 11, 2010 Share Posted December 11, 2010 Try CD /D <fullpath>:http://ss64.com/nt/cd.htmlcd /d C:\ Z0AA7~1jaclaz Link to comment Share on other sites More sharing options...
luke77 Posted December 11, 2010 Author Share Posted December 11, 2010 Try CD /D <fullpath>:http://ss64.com/nt/cd.htmlcd /d C:\ Z0AA7~1jaclazIt did not work.I ran it from j:\backup.Andy Link to comment Share on other sites More sharing options...
myselfidem Posted December 11, 2010 Share Posted December 11, 2010 (edited) I've tried successfuly this batch file from Explorer (desktop):cd /D D:\Program Filespause to see if errorsNo space between the backslash and the folder name or directory name.I've also tried to launch this batch file set inside an USB key and works fine (letter K:\). Edited December 11, 2010 by myselfidem Link to comment Share on other sites More sharing options...
Yzöwl Posted December 11, 2010 Share Posted December 11, 2010 The clue is in the question.CD will change the directory within a Prompt Window not within Windows Explorer.To open an explorer window, you will need to use explorer.exe with its approipriate switche(s).Try this:XploreIt.cmd@PUSHD %SYSTEMDRIVE%\@FOR /F "TOKENS=4" %%# IN ('DIR/X/AD Z0*^|FIND "<DIR>"') DO @( START EXPLORER /E,/ROOT,%%~f#)Please ensure that you use a unique string after DIR/X/AD on line two, (I have used the first two characters from your posted directory name in my example, but not knowing the actual name means I had to guess, you may need something like *0AA*) Link to comment Share on other sites More sharing options...
luke77 Posted December 12, 2010 Author Share Posted December 12, 2010 The clue is in the question.CD will change the directory within a Prompt Window not within Windows Explorer.To open an explorer window, you will need to use explorer.exe with its approipriate switche(s).Try this:XploreIt.cmd@PUSHD %SYSTEMDRIVE%\@FOR /F "TOKENS=4" %%# IN ('DIR/X/AD Z0*^|FIND "<DIR>"') DO @( START EXPLORER /E,/ROOT,%%~f#)Please ensure that you use a unique string after DIR/X/AD on line two, (I have used the first two characters from your posted directory name in my example, but not knowing the actual name means I had to guess, you may need something like *0AA*)I have been using this, but your solution looks more robust.Andy:: z.bat Help from alt.msdos.batch.nt Mic,Todd,Frank,:: Traverse from different drives:: dir /x utilized to determine the "secondary" directory name::%windir%\explorer.exe /e,/select,c:\Z0AA7~1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now