Search found 10 matches
- 2024-Jan-13, 5:53 pm
- Forum: Windows CMD Shell
- Topic: Shift command not working in wrapper script
- Replies: 3
- Views: 1862
Re: Shift command not working in wrapper script
Ah, I see. Thanks. That wouldn't be a problem here as all the scoop subcommands are single words and I think that would generally be the case in things like this. Cheers.
- 2024-Jan-13, 5:18 am
- Forum: Windows CMD Shell
- Topic: Shift command not working in wrapper script
- Replies: 3
- Views: 1862
Re: Shift command not working in wrapper script
I tried everything, but couldn't get the shift command to work, even outside the if conditional and in its own subroutine. After a lot of guiding and swearing I got ChatGPT to come up with this, and it finally works: @echo off if "%1" == "search" ( call :search_subroutine %* ) el...
- 2024-Jan-13, 1:50 am
- Forum: Windows CMD Shell
- Topic: Shift command not working in wrapper script
- Replies: 3
- Views: 1862
Shift command not working in wrapper script
I am using scoop . The search command is very slow, so there is a drop-in replacement written in Golang which is much faster: https://github.com/shilangyu/scoop-search While there is a PowerShell function to replace `scoop search [package]` with `scoop-search.exe [package]`, there isn't one for cmd....
- 2023-Oct-20, 12:31 pm
- Forum: Windows CMD Shell
- Topic: What's the best way to move directories and files?
- Replies: 1
- Views: 4306
What's the best way to move directories and files?
I want to move files and directories of files from one directory to another, which already contains some files and directories of files, maintaining the same directory structure. I was using two for loops with the move command, once for directories and once for files, but I couldn't get it to work. ...
- 2023-Aug-16, 8:06 am
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
Re: How to remove trailing backslash from %*
In case anybody is reading this, I have found that it's probably a bad idea to do this, as... 1. clink seems to be able to be set to expand ~ to %USERPROFILE%, but I'm not sure if it still works 2. It would be better to use clink's ability to do that so that it works with other commands like mv, cp,...
- 2023-Aug-16, 5:13 am
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
Re: How to remove trailing backslash from %*
I think I've fixed it: @echo off set dest=%* if '%dest%'=='' goto :cdd if qq%dest:~0,1%%dest:~-1%qq == qq""qq set dest=%dest:~1,-1% if '%dest:~0,1%' == '~' set dest=%USERPROFILE%%dest:~1% set dest="%dest%" set OLDPWD="%cd%" :cdd set pushd_tmp=%TEMP%\pushd.tmp set cdd_tm...
- 2023-Aug-16, 4:39 am
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
Re: How to remove trailing backslash from %*
Oh, well it's not working as well as I first thought... If there's a space in the path, this line causes and error: if '%dest:~0,1%' == '~' set dest=%USERPROFILE%%dest:~1% eg. >cd "Dir with spaces" The syntax of the command is incorrect. So this `if` command is being executed in some way e...
- 2023-Aug-16, 2:23 am
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
Re: How to remove trailing backslash from %*
Thanks. I didn't manage to get it working, but it doesn't matter as it would have only added minor convenience. However, I've been able to add (seemingly) full emulation of bash's tilde character to represent `%USERPROFILE%` to add to the `%OLDPWD%` variable. which is a much better addition I think....
- 2023-Aug-13, 9:31 pm
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
Re: How to remove trailing backslash from %*
This is the `cdd.cmd` script which is part of the Windows version of CD Deluxe: @echo off set pushd_tmp=%TEMP%\pushd.tmp set cdd_tmp_cmd=%TEMP%\cdd.tmp.cmd pushd > %pushd_tmp% %~dps0_cdd.exe %* < %pushd_tmp% > %cdd_tmp_cmd% %cdd_tmp_cmd% This is the version I have made which adds a `%OLDPWD%` variab...
- 2023-Aug-13, 1:52 pm
- Forum: Windows CMD Shell
- Topic: How to remove trailing backslash from %*
- Replies: 7
- Views: 10895
How to remove trailing backslash from %*
In cmd.exe `%*` appears to be the equivalent of `$*` in bash. Because of the program that I use to replace cd.... (which is CD Deluxe - I've been using it on Windows and Linux for more than 13 years and it really should be better known https://github.com/m6z/cd-deluxe) ...doesn't like trailing slash...