1

I have next to no knowledge of code so forgive my ignorance. I'm trying to run

netsh winsock reset

and

netsh int ipv4 reset

on a single command line. I tried using & and && but only the first command is executed.

Here's what I got from the other answers on here:

cmd /K netsh winsock reset & netsh int ipv4 reset

How can I get it to run the second command?

3
  • cmd /k "command&command" Commented Jun 27, 2017 at 8:40
  • Should be /c not /k. Commented Jun 27, 2017 at 8:49
  • Or: cmd /K command ^& command (or cmd /C command ^& command if you want the command window to close automatically afterwards) Commented Jun 27, 2017 at 9:05

1 Answer 1

1

Use cmd /K "netsh winsock reset & netsh int ipv4 reset"
You can refer here for more info.
Also this answer on StackOverflow may be useful

Sign up to request clarification or add additional context in comments.

6 Comments

Should be /c not /k
Thank you, that worked! I'll know to add those from now on. I was using /k so I could verify both commands worked, I'll switch it to /c now that I know they're both executed.
@HarryJohnston Depending upon your need. /C Run Command and then terminate /K Run Command and then return to the CMD prompt. This is useful for testing, to examine variables
There are situations in which /k is preferable, but they're rare. The OPs description does not suggest that this is one of them.
I don't think that, for OP, it matters anymore. It can be used based upon need. Since in problem /K is used so the same is provided here.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.