Guest User

Use wfolder to change directory on Windows

a guest
Aug 17th, 2013
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. rem Based on https://github.com/eteeselink/cdhere/blob/master/cdhere/src/cdhere.cmd
  3.  
  4. set CDWHERE=
  5.  
  6. :: execute cdwhere, store output in %CDWHERE%
  7. :: cdwhere will write any errors to stderr
  8. for /f %%a in ('%~dp0wfolder.exe') do SET CDWHERE=%%a
  9.  
  10. if "%CDWHERE%"=="" (
  11.   rem got error
  12. ) else (
  13.   cd /d %CDWHERE%
  14. )
  15.  
  16. :: remove %CDWHERE%
  17. set CDWHERE=
Advertisement
Add Comment
Please, Sign In to add comment