In Windows PowerShell (and CMD and bash) it would be nice to
pushd and then copy to the last directory I was in. ex:
> pwd Path ---- D:\Some insanely long\path I really\ don/'t want to type\because it's hard\vimstuff\ > pushd ..\..\..\..\thing that\lives in the swamp > cp *.pu $popd
where $popd would be the last directory pushed. Does this functionality exist or would I need to write a script?
Edit: Looks like everyone is answering helpful tips for getting closer to the solution but not quite there yet. It may not be possible in powershell. I was looking for something like the following that I wrote for cmd but doesn't work in powershell:
echo off if "%olddirp%"=="" ( echo olddirp not defined, use cdp to push directory before using cpp ) else ( for %%A in ("" "help" "-help" "/help" "-h" "/h") do ( if "%1"==%%A goto help ) ) copy %1 %olddirp% echo .\%1 copied to %olddirp%\%1 goto end :help echo "cdp / cpp usage: cdp to directory 'cpp c:\newdir' then cpp files to previous directory 'cpp somefile'" :end
set olddirp=%cd% cd %1
Can those be easily translated? I had trouble because apparently there's no
%path% or any other simple variable in powershell.