What does /p mean in set /p? - windows

What does /p stand for in set /p=? I know that / enables a switch, and I'm fairly sure that I know /a is for arithmetic. I've heard numerous rumours, some saying /p is for prompt, others stating it stands for print. The only reason I slightly doubt it is prompt is because in many cases it does not ask for a prompt, yet prints on the screen, such as
<nul set /p=This will not generate a new line
But what I want to know is: Do we really know what it stands for?

The /P switch allows you to set the value of a variable to a line of input entered by the user. Displays the specified promptString before reading the line of input. The promptString can be empty.
Two ways I've used it... first:
SET /P variable=
When batch file reaches this point (when left blank) it will halt and wait for user input. Input then becomes variable.
And second:
SET /P variable=<%temp%\filename.txt
Will set variable to contents (the first line) of the txt file. This method won't work unless the /P is included. Both tested on Windows 8.1 Pro, but it's the same on 7 and 10.

For future reference, you can get help for any command by using the /? switch, which should explain what switches do what.
According to the set /? screen, the format for set /p is SET /P variable=[promptString] which would indicate that the p in /p is "prompt." It just prints in your example because <nul passes in a nul character which immediately ends the prompt so it just acts like it's printing. It's still technically prompting for input, it's just immediately receiving it.
NOTE: The answers below this point are for a previous version of the question.
/L in for /L generates a List of numbers.
From ping /?:
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name
Options:
-t Ping the specified host until stopped.
To see statistics and continue - type Control-Break;
To stop - type Control-C.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-l size Send buffer size.
-f Set Don't Fragment flag in packet (IPv4-only).
-i TTL Time To Live.
-v TOS Type Of Service (IPv4-only. This setting has been deprecated
and has no effect on the type of service field in the IP Header).
-r count Record route for count hops (IPv4-only).
-s count Timestamp for count hops (IPv4-only).
-j host-list Loose source route along host-list (IPv4-only).
-k host-list Strict source route along host-list (IPv4-only).
-w timeout Timeout in milliseconds to wait for each reply.
-R Use routing header to test reverse route also (IPv6-only).
-S srcaddr Source address to use.
-4 Force using IPv4.
-6 Force using IPv6.

Related

Check whether a Windows certificate is valid by date - using CMD

My target it to check whether a certificate (I have its exact name, in the example below it is "Dell") in any Windows computer is valid.
The way I think I can do it, is by taking the expiration date, and compare it with the current date.
So, first, I want to take the expiration date ("not after" field).
The way I did it:
certutil -verifystore Root Dell | findstr/n ^^ | findstr "^[6]:" | for /f "tokens=3-5 delims= " %f in ('more') do #echo %f %g %h
Output: 3/8/3020 8:47 PM
But note this is matching my regional date format. I need it to be generic- in a way it would work for all possible formats
Now, for any Windows computer I have the date.
Next step, is to get the current date with %date% variable, and calculate the seconds (?) difference between the two dates. With that result I could know whether the certificate is expired or not.
I can't find how to do so. Any advice?
Few notes:
No PowerShell
only 1 cmd command
The result of this 1 command should be the seconds difference of the 2 dates
Any other way to verify a certificate is acceptable. The way above is the only 1 I know

Getting lot of 'del' call on GCP Memorystore. But couldn't identify its source

I am getting a lot of 'del' call on GCP Memorystore approx at a rate of 6k/sec. But I am unable to identify the source that's making these 'del' calls.
I have tried accessing logs of the particular memory-store server but didn't get anything related with calls information.
I need to figure out who is making these 'del' calls on my memorystore.
Any suggestions......
Thanks
You may use monitor command to list every command processed by Redis server. You need to use with grep to filter DEL commands from the whole stream. By default grep is case sensitive, -i is added for to filter both DEL and del.
redis-cli -h your.host.name monitor | grep -i del
it will print in following format. You may use ip address to identify who is deleting.
1588013292.976045 [0 127.0.0.1:44098] "del" "foo"
1588013294.875606 [0 127.0.0.1:44098] "DEL" "foo"
1588013298.285791 [0 127.0.0.1:44098] "dEl" "foo"
Using monitor is not going to be free, please check the benchmark numbers.

How to use the fast ping with alot of ip addressess in cmd to send alot of packets for every hop?

What have I tried
I wanted to create a way to make a faster pinging method for cmd than the normal '-t' command. So I came up with an idea to make two files and link them together:
The first st1.bat file contains
ping 10.10.10.10 -n 1
st2.bat
And the second st2.bat file contains
ping 10.10.10.10 -n 1
st1.bat
This creates a loop so it goes on forever.
The '-n' command is the number of packets you send. So by sending just one packet and then opening the second .bat file makes it a lot faster (30 milliseconds).
The command for extracting just the IP addresses is:
(#for /f "tokens=8" %a in ('tracert -4 -d wikipedia.org^|find "ms"') do #echo start ping %a)>ips.txt
What do I need
I want to combine these two codes and make 2 files for each IP to create a loop just like I showed you above. Every IP loop should have its own cmd window because if everything is in one window every packet should wait for the previous one to be done:
And finally link all the files together in one .bat file that I think will look like that:
Start st1.bat
Start st3.bat
Start st5.bat
Try to use: ping -n 1 -l 1
if you doesn't want
Firing with 1 bytes of data: try this command:
#echo off
:1
ping -n 1 -l 1 | find "TLL="
goto 1

How to consistently record command output in a variable in UNIX

In some cases what I see in a console output is different from what I get recorded after redirection. I see this on Linux/bash but this example is ksh/OpenBSD. Is there a way around this?
For example:
# pfctl -ttable -Ttest 123.123.123.123 > result.txt
0/1 addresses match.
# more result.txt
result.txt (END)
In other words the "0/1 addresses match." is printed on the console, but I cannot for the life of me get it into a file, variable or anything. I've used $() and > which work for most commands, but every now and then there is a command that spits out stuff on the screen but I get nothing via the redirect/pipe. I hope someone can shed light on this peculiarity.
So again contrast this:
# OUTP=$(pfctl -tscanners -Ttest 123.123.123.123)
0/1 addresses match.
# echo $OUTP
#
(nothing echoing, the variable does not hold the console output) with this:
# OUTP=$(date)
# echo $OUTP
Sun Aug 21 08:33:37 PDT 2016
#
(the variable contains the entire console output)
Thanks again for any help.
Your command has 2 different output streams.
You need to rederict the second (stderr) to the first.
pfctl -ttable -Ttest 123.123.123.123 > result.txt 2>&1

Change standard separator comma for attachments

I know that comma will be used to separate files and other stuff with Blat mailer.
But I must send files with a comma in their filenames and have no possibility to change this circumstance.
Is there a way to change the standard separator?
Or any other way without changing the filename?
Here my example what I try to do:
set SERVER=127.0.0.1:2525
set USER=sendout#ralfbb-test.local
set PW=secret
set FROMNAME=sendout#ralfbb-test.local
set TO=nurmail1#ralfbb-test.local
set SUBJECT="Subject test - attached file!"
set BODY="Oh yes my dear lad!"
set BODYF="c:\Mailbody.txt"
set ATTACH="c:\517-BS24430-210416-NULL-0,750.pdf"
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %SUBJECT% -bodyF %BODYF% -attach %ATTACH% -debug -log blat.log
Add a "" when calling the variable:
"%ATTACH%"

Resources