windows


Eval script containing PATH in Windows CMD


I need to eval the commands thrown by some command 'minishift oc-env' which has PATH in it.
However, it seems that it is overwriting the whole PATH variable.
C:\Users\budhram>echo %PATH%
C:\Program Files\Docker\Docker\Resources\bin;C:\Users\budhram\AppData\Local\Temp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;.....
C:\Users\budhram>minishift oc-env
SET PATH=C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
REM Run this command to configure your shell:
REM #FOR /f "tokens=*" %i IN ('minishift oc-env') DO #%i
C:\Users\budhram>SET PATH=C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
C:\Users\budhram>echo %PATH%
C:\Users\budhram\.minishift\cache\oc\v1.5.0;C:\Program Files\Docker\Docker\Resources\bin;C:\Users\budhram\AppData\Local\Temp;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;....
C:\Users\budhram>#FOR /f "tokens=*" %i IN ('minishift oc-env') DO #%i
C:\Users\budhram>echo %PATH%
C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
Any idea how we can do that?
This answer http://stackoverflow.com/a/9370376/1120530 also suggest about using setlocal enableDelayedExpansion which seems to be not working in my case.
When you run
#FOR /f "tokens=*" %i IN ('minishift oc-env') DO #%i
the do clause will execute
SET PATH=C:\Users\budhram\.minishift\cache\oc\v1.5.0;%PATH%;
which seems correct, BUT the problem is that after %i has been expanded to the indicated command, there is not a second expansion to convert %PATH% to the value in the variable.
You can try with
#FOR /f "tokens=*" %i IN ('minishift oc-env') DO #call %i
where the call command will force a second parse phase that will expand the %PATH% reference.

Related Links

xvimagesink not found by gst-inspect
How to delete all text file from a directory accept one through batch file?
windows copy files on the basis of modified date
How to get Service name and status
Using windows CMD to list ISCSI drives?
RSA Encryption/decryption within windows crypto library dll?
Powershell script to call git init in all subdirectories
NETSH Command in Windows 7
How to Dir Remote Server
Windows Service initialized before network connection with SSD
Batch Script Find String in String with a twist
Issue using grok filter with logstash and a windows file
What means tilde in windows file pattern
Possible to capture unhandled exception in win32 user application ? (setunhandledexceptionfilter())
How to Import a CSV and read a line from text file using PowerShell?
How to make a batch file tell if it is elevated or not

Categories

HOME
phantom-dsl
redux-form
formal-languages
twig
themes
obfuscation
access
seo
rds
android-json
special-characters
rcloud
jquery-ui-sortable
reactive-programming
openpyxl
siddhi
cmdb
speech-synthesis
qsqlquery
atlassian-stash
intershop
chargify
easyphp
digital-signature
identity-management
delphi-xe5
oledb
windows-xp
sar
angular-routing
qliksense
resourcebundle
perlbrew
definitelytyped
asymptotic-complexity
progress-bar
underscore.js
event-flow
recurring-events
scatter3d
python-2.6
simplecv
joomla2.5
modalviewcontroller
hivemq
sql-server-ce
projects-and-solutions
mcustomscrollbar
postgresql-8.4
microsoft-metro
yii2-api
semantic-logging
ngmaterial
gameplay-kit
rmongo
cubism.js
mongodb-php
ng-grid
synonym
eigenvector
respondcms
aurora
pushbots
computer-architecture
vigenere
sony-lifelog-api
apache-spark-1.3
angular-gettext
boost-program-options
insight.database
ignite-ui
personalization
tinyxml
clickbank
bin
model-driven-development
unit-of-work
video-codecs
twisted.web
panda3d
josql
android-holo-everywhere
tournament
timertask
openfaces
lxr
web-application-project
visualj#
fdf
xslcompiledtransform
idatareader

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App