0

I have a file that I wish to update through a batch file. I am able to open the file in its application but not run CTRL+R to update it. Code below.

START "" "path to application" "path to file"

SLEEP 10

WshShell.SendKeys “^r”

This results in the file being opened but not refreshed. Any tips?

npocmaka
  • 51,748
  • 17
  • 123
  • 166
  • Have you tried the steps here https://stackoverflow.com/questions/17038282/press-keyboard-keys-using-a-batch-file? I am just guessing since your code snip is very small. I just assume that you are initializing the WshShell object correctly. – Daniel Lee Jul 07 '17 at 11:49
  • I looked through that one but the difference is that I open a file in another application. I have read somewhere that the batch file pauses until the other application is terminated but not sure if that effects me here. – Marcus Högenå Bohman Jul 07 '17 at 12:01
  • check [this](https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/sendKeys.bat) – npocmaka Jul 07 '17 at 12:17
  • Thanks @npocmaka, I'll try that. One of my colleagues have the below code to do the same for the same type of file (A QlikView file). It doesn't work for me but I guess there is a similarly easy solution out there for me as well. "path to application" /r "path to file" – Marcus Högenå Bohman Jul 07 '17 at 12:24

1 Answers1

0

I managed to find the issue myself. It turns out that

"path to application" /r "path to file" 

was a viable solution as long as the paths didn't contain any scandinavian characters. It opens a file in a application presses CTRL+R which reloads my file.