How to do an input redirect (equivalent to "" in Linux) with PowerShell?

1

In Linux, when we want to do an exit redirection, we use the symbol > .

 echo "Olá mundo" > Hello.txt

I did the above test in PowerShell and got the same result.

It turns out that when I needed to import a SQL via the command line, I could not do the same thing I do in Linux when using "inbound redirection."

mysql -u root database_name < /caminho/para/o/arquivo.sql

How do I make this input redirect in PowerShell?

    
asked by anonymous 28.05.2018 / 16:39

2 answers

1

See if this solves for you:

Get-Content /caminho/para/o/arquivo.sql | mysql -u root database_name

You reverse the situation, take the content and send it to a command by doing piping .

    
28.05.2018 / 16:51
0

As an alternative you could use mysql-client to do this:

mysql -u root database_name
mysql> tabela /caminho/para/o/arquivo.sql
    
28.05.2018 / 16:57