PsExec "-f" results in help output RRS feed

  • Question

  • I'm trying to use PsExec to run a script, but I need to be sure the latest version of the script is on the computer, so I've been trying to use the -f switch (since -c won't copy the file if it already exists). However, -f results in the same output as psexec /? and I'm not sure why. Any ideas on what would cause this?

    Working command (sanitized):

    psexec \\machine -u username -p password -h -c C:\temp\thething.cmd

    Failing command:

    psexec \\machine -u username -p password -h -f C:\temp\thething.cmd

    Thursday, December 5, 2019 9:43 PM

All replies

  • Because the sintax you are using is wrong.

    -f comes after -c, and it means "the file you are copying with the -c parameter, must be forcibly copied over even it already exists", and must be used this way:

    psexec \\machine -u user -p pwd -h -c c:\temp\pippo.cmd -f

    it is a suboption of -c, like -v


    [-c  <filename> [-f|-v]]


    • Proposed as answer by mariora_ Thursday, December 5, 2019 10:42 PM
    Thursday, December 5, 2019 10:42 PM