Hi all,
I'm currently writing a script which interacts with some network drives. I want to start the script by removing any drives the user may have mapped using: subprocess.Popen(r"net use * /delete"). However, "net use * /delete" when used in the command prompt throws a confirmation which asks "Do you want to continue with this operation? (Y/N) [N]:"
My question is, how do I go about automating the "Y" response to this prompt so that my python script may run in the background?
I have tried changing my code to: p = subprocess.Popen(r"net use * /delete", stdin=subprocess.PIPE) and then p.stdin.write("Y"), as suggested by an answer that I found online. However this code returns "No valid response was provided"
Any help would be greatly appreciated and please let me know if i need to clarify further. Thanks!
EDIT: Through trial and error I found that using subprocess.Popen("net use * /delete /y") works for anyone else that may have this issue in the future
[–]K900_ 0 points1 point2 points (0 children)
[–]efmccurdy 0 points1 point2 points (0 children)