store the output of powershell command in a variable

debal

The following commnad:

$sun=PowerShell [DateTime]::Today.AddDays(-8).ToString('dd-MMM-yyyy')

echo %sun %

the output of the echo is

PowerShell [DateTime]::Today.AddDays(-8).ToString('dd-MMM-yyyy')

how do i get it to output something like

22-Sep-2013

Joey

You need to use for /f:

for /f "usebackq" %%x in (`powershell "(Get-Date).AddDays(-8).ToString('dd-MMM-yyyy')"`) do set sun=%%x

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

store ftp command output in a variable

From Dev

Store the output of command in variable in unix

From Dev

Store output in variable & use variable in command

From Dev

Store output of sed with command substitution in it into a variable

From Dev

Executing linux command in java and store the output in variable

From Dev

How to store linux command output into a variable in puppet

From Dev

Batch - Store command output to a variable (multiple lines)

From Dev

Store filtered output of cmd command in a variable

From Dev

Store grive command output to variable in bash script

From Dev

execute commands and store command output to variable

From Dev

Store output of a command in a variable without losing $? value

From Dev

Store multiple grep in one command output to a variable

From Dev

Not able to store output of awk command into a variable

From Dev

Encapsulate the output of invoke command in a variable - PowerShell

From Dev

How to store the output of a command in a variable at the same time as printing the output?

From Dev

How to store the output of a command in a variable at the same time as printing the output?

From Dev

Store command output in variable when command includes pipes

From Dev

How do i store the output of a bash command in a variable?

From Dev

Curl command from Python Subprocess to store output into variable

From Dev

how do I store the output of a cut command into a variable

From Dev

How to store multiple lines of command output to a variable using JSch

From Dev

Store output of command into the array

From Dev

Store output of command into the array

From Dev

Store output of command with error

From Dev

Save the output of a powershell command in a variable and use it in batch script?

From Dev

store awk output in variable

From Dev

Store netcat output into variable

From Dev

Store ansible output to variable

From Dev

Store the result of a command in a variable

Related Related

  1. 1

    store ftp command output in a variable

  2. 2

    Store the output of command in variable in unix

  3. 3

    Store output in variable & use variable in command

  4. 4

    Store output of sed with command substitution in it into a variable

  5. 5

    Executing linux command in java and store the output in variable

  6. 6

    How to store linux command output into a variable in puppet

  7. 7

    Batch - Store command output to a variable (multiple lines)

  8. 8

    Store filtered output of cmd command in a variable

  9. 9

    Store grive command output to variable in bash script

  10. 10

    execute commands and store command output to variable

  11. 11

    Store output of a command in a variable without losing $? value

  12. 12

    Store multiple grep in one command output to a variable

  13. 13

    Not able to store output of awk command into a variable

  14. 14

    Encapsulate the output of invoke command in a variable - PowerShell

  15. 15

    How to store the output of a command in a variable at the same time as printing the output?

  16. 16

    How to store the output of a command in a variable at the same time as printing the output?

  17. 17

    Store command output in variable when command includes pipes

  18. 18

    How do i store the output of a bash command in a variable?

  19. 19

    Curl command from Python Subprocess to store output into variable

  20. 20

    how do I store the output of a cut command into a variable

  21. 21

    How to store multiple lines of command output to a variable using JSch

  22. 22

    Store output of command into the array

  23. 23

    Store output of command into the array

  24. 24

    Store output of command with error

  25. 25

    Save the output of a powershell command in a variable and use it in batch script?

  26. 26

    store awk output in variable

  27. 27

    Store netcat output into variable

  28. 28

    Store ansible output to variable

  29. 29

    Store the result of a command in a variable

HotTag

Archive