dnk.nitro
dnk.nitro

Reputation: 496

Pass batch file ECHO into PUSHD command prompt command

I have a windows batch file, which outputs directory path, e.g.:

@echo c:\windows

I would like to pass this string "c:\windows" into PUSHD command. I tried this:

path.bat | PUSHD 

but it errors out with "The process tried to write to a nonexistent pipe.".

Please help.

The solved command prompt log would look something like:

c:\>path.bat | PUSHD
c:\Windows>

Upvotes: 2

Views: 1119

Answers (1)

Raymond Chen
Raymond Chen

Reputation: 45173

Basic idea (you will need to make appropriate adjustments):

for /f %i in ('path.bat') do pushd %i

Upvotes: 3

Related Questions