I'm attempting to copy/paste some long, multiple line command line commands into a Windows 10 Command Prompt.
Linux uses the "\" character for this, so for example in Linux you could copy/paste the following from a website or text file into a terminal Window (I'm supposing using a graphical desktop environment here):
python retrain.py \
--bottleneck_dir="/tf_files" \
--how_many_training_steps=500 \
--model_dir="/tf_files" \
--output_graph="/tf_files/retrained_graph.pb" \
--output_labels="/tf_files/retrained_labels.txt" \
--image_dir="/tf_files/flower_photos"
Then press enter and the command will run. This looks much more clear on a website or in a text file you've saved.
Problem is, I can't seem to work out a Windows equivalent for this. I realize the ^ character is equivalent to the Linux \ character in this context, but it does not seem to work for copy/paste. For example, if make a text file "dummy1.txt", then copy/paste in the following:
copy dummy1.txt ^
dummy2.txt
(note there is a space on both sides of the ^ character on the 1st line)
I get this:
For this two line example this does not matter, but for more elaborate commands such as the python script above, putting everything on one line in any documentation that needs to be copies/pasted out of sacrifices readability severely. Is there a way to get this to work on Windows? I'm using Windows 10 currently if that matters.
I think you need to powershellafy it like this:
$retrain = @{
bottleneck_dir = “/tf_files”
how_many_training_steps = “500"
model_dir= "/tf_files"
output_graph = "/tf_files/retrained_graph.pb"
output_labels = "/tf_files/retrained_labels.txt"
image_dir = "/tf_files/flower_photos"
}
#imaginary equivalent script
retrain.ps1 $retrain
If you are simply looking to break lines into multiple lines the escape character is a back tick `
get-longcommand -name "long command" `
-date "today" `
-other-info "other stuff"
Lastly, please understand a 'Foreach' loop. There are multiple kinds, here is an easy one
$copy_list = @(get-childitem "C:\Path\to\files")
$new_dest = "C:\New\File\Destination"
foreach ($file in $copy_list) {
#This is for troubleshooting, outputs which file it is running
$file
copy-item -Path $file -Destination $new_dest
}
There may be something like $file.fullname or something like that to transfer the path. If you use Powershell ISE, and use the debug routine, pause right after '$file' in the loop, and you can see the details.
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With