Support ~ and :path in COPY

samintz

Scott Mintz
May 20, 2008
1,465
15
Solon, OH, USA
The tilde shortcut is very handy. It looks like only the CD/CDD command can use it, however.

For example it would be really handy to do something like: COPY file ~\desktop. Or the :path syntax supported by CD.
e.g. copy file :Desktop
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,353
82
Albuquerque, NM
prospero.unm.edu
Not to disparage your suggestion at all, but you can use directory aliases in most file-handling commands:
Code:
C:\>alias *:
desk:=%@shfolder[16]\
dl:=%userprofile\downloads\
docs:=%@shfolder[5]\
etc:=%systemroot\system32\drivers\etc\
gd:=%userprofile\google drive\
progs:=%@shfolder[38]\
shell:=%@path[%_cmdspec]
sys:=%@shfolder[37]\
user:=%userprofile\
win:=%@shfolder[36]\

C:\>
 

samintz

Scott Mintz
May 20, 2008
1,465
15
Solon, OH, USA
The issue is that I am doing more and more work in WSL2 using bash. And the git bash prompt. And bash supports copying to and from ~ .

I am constantly messing up the / and \ in path names. And longing for the ease of doing things in TCC...
 
Not sure if this will be of any benefit, but I have tcc.exe as an alias in my Bash Profile;
Code:
alias tccrt='/mnt/c/program\ files/jpsoft/tcc_rt_27/tcc.exe /I /C'

That way, I can run a TCC command while in bash;
Code:
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$ alias tccrt
alias tccrt='/mnt/c/program\ files/jpsoft/tcc_rt_27/tcc.exe /I /C'
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$ tccrt echo %_isodate
2021-01-06
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$

Joe
 
Oct 18, 2009
358
17
Not sure if this will be of any benefit, but I have tcc.exe as an alias in my Bash Profile;
Code:
alias tccrt='/mnt/c/program\ files/jpsoft/tcc_rt_27/tcc.exe /I /C'

That way, I can run a TCC command while in bash;
Code:
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$ alias tccrt
alias tccrt='/mnt/c/program\ files/jpsoft/tcc_rt_27/tcc.exe /I /C'
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$ tccrt echo %_isodate
2021-01-06
jlc@DESKTOP-H2JFFTF:/mnt/e/Utils$

Joe
This DEFINITELY needs to be posted somewhere on the website, not just buried in a response an unrelated topic!
 
Nov 2, 2008
225
2
I use this batch file. It works under CMD etc, and not only changes to the desired directory, but you can open the folder in explorer.

You can have your own 'special' folders on top of this. This is what HKLM\Software\Wendy\Folders does. So for example, if I want to show what's in the mail-downloads, I run cdf /o email

The regkey is maintained in my setup files. It's simply a batch file, designed to connect the copied software to the shell, through reg.exe calls.

Capture.PNG


One of the joys of the private setup is I maintain my own menu, directly connected to the same folders.

Code:
:: set folders for windows 2k, xp [0config.cmd]
set zreg=Software\Wendy\Folders
...
reg add HKLM\%zreg% /f /v appdir /d %zwin%
reg add HKLM\%zreg% /f /v appdata /d %zapp%
reg add HKLM\%zreg% /f /v batch /d %zdir%\cdata\batch
reg add HKLM\%zreg% /f /v books /d %zbook%

A command "cdf batch" opens the batch file directory.

You can open the standard stuff too, such as cdf sendto

conset is Frank Westlake's utility.

Code:
@echo off
:: cd shell folder.
if /i "%1"=="/?" goto :ttyhelp
if /i "%1"=="" goto :ttyhelp
set zdir=
set zshf=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
set zapp=Software\Microsoft\Windows\CurrentVersion\App Paths
if /i "%1"=="/m" goto :hklm
if /i "%1"=="/u" goto :hkcu
if /i "%1"=="/w" goto :hkwe
if /i "%1"=="/i" goto :image
if /i "%1"=="/a" goto :happ
set zcmd=chdir
set zhere=%*
if "%1"=="/o" set zcmd=open
if "%1"=="/o" set zhere=%zhere:~3%
conset /q /k zdir=HKLM\%zshf%\%zhere%
if not "%zdir%"=="" goto :doit
conset /q /k zdir=HKCU\%zshf%\%zhere%
if not "%zdir%"=="" goto :doit
conset /q /k zdir=HKLM\Software\Wendy\Folders\%zhere%
if not "%zdir%"=="" goto :doit
goto :end

:hklm
shelexec reg:hklm\%zshf%
goto :end
:hkcu
shelexec reg:hkcu\%zshf%
goto :end
:hkwe
shelexec reg:hklm\software\wendy\folders
goto :end
:happ
shelexec reg:hklm\%zapp%
goto :end
:image
set zdir=Microsoft\Windows NT\CurrentVersion\Image File Execution Options
shelexec reg:hklm\software\%zdir%
goto :end

:ttyhelp
echo CDF changes to a directory stored in registry, or shell folder.
echo.
echo   /o  Open the named folder in explorer.
echo   /m  Display the shell folders in the machine tree
echo   /u  Display the shell folders in the user tree
echo   /w  Display the folders in HKLM\Software\Wendy\Folders
echo   /i  Display the image settings tree for hacks etc.
echo.
echo  name  Changes to first instance of name in the above order.
goto :end

:dexe
goto :end

:doit
set zcxm=
if %zcmd%==chdir cd /d %zdir%
if %zcmd%==open shelexec %zdir%
:end
set zdir=
 

Attachments

  • Capture.PNG
    Capture.PNG
    32.3 KB · Views: 25