how to have powershell.exe inherit the current directory settings as the set-location values?


below 1 of cmd.exe batch files uses powershell script.   problem powershell.exe not know current directories cmd.exe has set on potential drive letters might use in arguments.
there easy way allow powershell.exe know these settings set-location can done access files named arbitrary drive letter locations in call batch file?

<# c: #> type \bin\bc.bat  @echo off % bc.bat powershell version %    if (%1)==() goto eof    if not exist "%1" goto eof  if not exist "%2" goto eof    if exist %temp%.\bc.out del %temp%.\bc.out    powershell -noprofile -command "& {c:\bin\larry_weiss_compare-textfile.ps1 %1 %2 %3|out-file c:\users\larry\appdata\loc  al\temp\bc.out -encoding ascii}"    call uedit %temp%.\bc.out    goto eof    :eof

probably cleanest pass full paths powershell script, then.  try this:

powershell -noprofile -command "& {c:\bin\larry_weiss_compare-textfile.ps1 '%~dpnx1' '%~dpnx2' %3|out-file c:\users\larry\appdata\loc al\temp\bc.out -encoding ascii}" 



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file