Reputation: 111
I want my script to:
What is wrong with the following code? The ECHO
statement just prints Your directory is set to
; the DIR
statement works as expected.
@ECHO OFF
SET custompath = "C:\Users\%1"
ECHO Your directory is set to %custompath%
DIR %custompath%
Upvotes: 0
Views: 306
Reputation: 29669
Personally, I would do it this way:
@ECHO OFF
SET /P "custompath=Enter a custom windows path: "
ECHO Showing contents of directory ^"%custompath%^"
DIR /b "%custompath%"
pause
Upvotes: 0