Search found 93 matches

by Simon Sheppard
2022-Sep-17, 8:27 am
Forum: Windows CMD Shell
Topic: FOR parameters
Replies: 4
Views: 93

Re: FOR parameters

If you are testing the snippet at the command line, you will need to change the %%f to just %f
by Simon Sheppard
2022-Sep-15, 4:49 pm
Forum: Windows CMD Shell
Topic: FOR parameters
Replies: 4
Views: 93

Re: FOR parameters

To troubleshoot this you could try putting an ECHO before the "C:\Program Files\7-Zip\7z.exe"
so you can see what it is passing to 7z.

I don't think you need that asterisk after the "F:\client_1\"
by Simon Sheppard
2022-Sep-14, 4:42 pm
Forum: Windows CMD Shell
Topic: Runas example for running dsa.msc as a different user doesn't seem to work
Replies: 3
Views: 71

Re: Runas example for running dsa.msc as a different user doesn't seem to work

Thanks, I have added that to the RUNAS example now, I don't know why the START is needed, perhaps someone else can explain it?
by Simon Sheppard
2022-Sep-11, 9:01 am
Forum: Windows CMD Shell
Topic: Robocopy /IM
Replies: 3
Views: 728

Re: Robocopy /IM

@workablob, from your email address it looks very much like you may in fact be David Kendrick the author of copyrite xp and you have been spamming this identical message around multiple IT forums which mention robocopy, it is not a good look. Also the website for copyrite xp is currently down, so ma...
by Simon Sheppard
2022-Aug-19, 1:17 pm
Forum: Windows CMD Shell
Topic: How do I check the length of a filename in batch script?
Replies: 1
Views: 7158

Re: How do I check the length of a filename in batch script?

Assuming you have the full path/filename, then use Parameter Extensions to split out just the filename, or filename+extension.

Then to get the length use Strlen
by Simon Sheppard
2022-Aug-05, 2:50 pm
Forum: Windows CMD Shell
Topic: How to replace all characters in a variable with another character?
Replies: 2
Views: 559

Re: How to replace all characters in a variable with another character?

If this is to represent a password, it is worth considering do you really need to represent the right number of characters? Hiding the length of a password is generally good security, then you can just display a fixed line of *******'s OTOH if this is something like a username or email address, then...
by Simon Sheppard
2022-Jul-20, 7:14 pm
Forum: Windows CMD Shell
Topic: Double Quotes embedded in Double Quotes
Replies: 3
Views: 345

Re: Double Quotes embedded in Double Quotes

OK that's done, I also added a couple of alternatives :)
by Simon Sheppard
2022-Jul-18, 8:03 pm
Forum: Windows CMD Shell
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 414

Re: "call exit" - Exit batch file from call subroutine

PiotrMP006 wrote: 2022-Jul-18, 6:54 am
Both options are described here: https://ss64.com/nt/call.html
The "call exit" solution is not described here "https://ss64.com/nt/call.html" !!!
It is described in the section:
CALL a subroutine (:label)
by Simon Sheppard
2022-Jul-17, 1:35 pm
Forum: Windows CMD Shell
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 414

Re: "call exit" - Exit batch file from call subroutine

I tend to use Goto :eof

Both options are described here: https://ss64.com/nt/call.html