I'm using digiKeyboard library to type to a powershell, but I need to type a backslash (a lot of them), but I can't figure it out.
I have been looking for the solution for about 3 hours and I still can't find it. Please let me know how to make a backslash work.
The powershell command that I want to execute:
cmd /C "start /MIN powershell iwr -Uri https://tinyurl.com/WjnAU6 -OutFile c:\windows\temp\b.jpg;sp 'HKCU:Control Panel\Desktop' WallPaper 'c:\windows\temp\b.jpg';$a=1;do{RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True;sleep 1}while($a++-le59)"
It just changes the wallpaper with a downloaded image, try in on your friend.
1 Answer 1
To include \
in a string so it can be printed you have to escape it. \
is itself the escape character, so doubling it up "escapes the escape character" so it is interpreted as a normal character.
So to print "c:\windows"
you would actually have to type "c:\\windows"
and the \\
gets changed by the compiler into just \
print("\\")