Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
9 years ago

write text file from command prompt

if I run below in TC works fine ...could see cmd prompt restarting server Sys.OleObject("WScript.Shell").Run("iisreset MyComputer"); if I type below in cmd prompt and manually run it works  iisres...
  • HKosova's avatar
    9 years ago

    Add "cmd /c" at the beginning of your command:

    Sys.OleObject("WScript.Shell").Run("cmd /c iisreset MyComputer > C:\\MyFolder\\iisRestarted.txt");

    Output redirection is a feature of the command shell (cmd.exe), so you need to run your command via cmd.

     

    Also make sure you run TestComplete as administrator, as required by iisreset.