Guest User

Untitled

a guest
Oct 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. if "!srcpath:~-1"==""" set srcpath=!srcpath:~0,-1!
  2.  
  3. set srcpath=%srcpath:"=%
  4.  
  5. 1. Add a "? to the end of your string
  6. 2. Then delete ""? from that string
  7. 3. Then delete "? from that string
  8.  
  9. :: SAMPLE -- Just a trailing quote removed
  10. set srcpath="c:source path"
  11. set srcpath=%srcpath%"?
  12. set srcpath=%srcpath:""?=%
  13. set srcpath=%srcpath:"?=%
  14. echo srcpath=%srcpath%
  15.  
  16. ::You can use the SAME TRICK to remove a trailing backslash
  17.  
  18. SET /P "%SRCPATH=Enter the source path "
  19. ECHO %SRCPATH%
  20. ECHO %SRCPATH:"=%
Add Comment
Please, Sign In to add comment