problems with CPAN::Tarzip running on a MiniCPAN mirror - windows

I created a local repository with minicpan in a Linux box, and then moved it to a Windows that has no access to online CPAN. But I'm getting this error messages when I try to use it:
cpan> install PowerBuilder::ORCA
Reading 'C:\Perl\minicpan\authors\01mailrc.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl\site\lib/CPAN/Tarzip.pm line 161.
"-qdt" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
............................................................................DONE
Reading 'C:\Perl\minicpan\modules\02packages.details.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl\site\lib/CPAN/Tarzip.pm line 161.
"-qdt" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
Warning: Your C:\Perl\minicpan\modules\02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more than one CPAN mirror. I'll continue but problems seem likely to
happen.
Caught SIGINT, trying to continue
Warning: Your C:\Perl\minicpan\modules\02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more than one CPAN mirror. I'll continue but problems seem likely to
happen.
Got another SIGINT
Reading 'C:\Perl\minicpan\authors\01mailrc.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl\site\lib/CPAN/Tarzip.pm line 161.
"-qdt" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
I'm suspecting this could be because of different carriage returns, but if someone has another idea about why this might be, it would be great. Also if it's because of carriage returns, do you have any idea on how to fix this without downloading the whole repository again on a Windows machine?

Delete the CPAN configuration and run its first-time configuration again.
It's still referencing e.g. the Linux path to tar, and using ANSI terminal escapes for colours.

Related

'C:\Program' is not recognized as an internal or external command in 'Git Bash Here' terminal - Windows (salesforce sfdx) - SOLVE

I'm here to ask you a very strange problem.
Right now i'm starting to work on Salesforce technology, in windows, and currently i follow the tutorial. When finally arrive to the terminal part, Windows come out to create problem...
I state that I am using the terminal of Git Bash Here (MinTTY)
$ sfdx force:data:record:create -s Account -v "Name='Hilton Union Square' BillingStreet='333 O Farrell St' BillingCity='San Francisco' BillingState='CA' BillingPostalCode='94102' Phone='(415) 771-1400' Website='www.hilton.com'"
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
More in general, the problem comes out every time there are Quote in the argument:
$ sfdx ""
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
opposite to:
$ sfdx
Salesforce CLI
VERSION
sfdx-cli/7.157.0 win32-x64 node-v16.15.1
USAGE
$ sfdx [COMMAND]
TOPICS
alias manage username aliases
auth authorize an org for use with the Salesforce CLI
config configure the Salesforce CLI
......
I try almost every thing: alias, Path, Full Path, Short Path, Quote, ...
this is my current path:
PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/A409806/bin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/WindowsPowerShell/Scripts:/cmd:/c/Program Files/nodejs:/c/Users/A409806/AppData/Local/Microsoft/WindowsApps:/c/Program Files/sfdx/bin:/c/Users/A409806/AppData/Roaming/npm:/c/Users/A409806/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/A409806/AppData/Local/JetBrains/Toolbox/scripts:/usr/bin/vendor_perl:/usr/bin/core_perl
Please, someone help me, i suppose is MinTTY problem, but i can't immage how solve it.
Thanks agane
UPDATE
I expose same problem and find de solution here:
Solution

How to read a file in utf8 encoding and output in Windows 10?

What is proper procedure to read and output utf8 encoded data in Windows 10?
My attempt to read utf8 encoded file in Windows 10 and output lines into terminal does not reproduce symbols of some languages.
OS: Windows 10
Native codepage: 437
Switched codepage: 65001
In cmd window issued command chcp 65001. Following ruby code reads utf8 encoded file and outputs lines with puts.
fname = 'hello_world.dat'
File.open(fname,'r:UTF-8') do |f|
puts f.read
end
hello_world.dat content
Afrikaans: Hello Wêreld!
Albanian: Përshendetje Botë!
Amharic: ሰላም ልዑል!
Arabic: مرحبا بالعالم!
Armenian: Բարեւ աշխարհ!
Basque: Kaixo Mundua!
Belarussian: Прывітанне Сусвет!
Bengali: ওহে বিশ্ব!
Bulgarian: Здравей свят!
Catalan: Hola món!
Chichewa: Moni Dziko Lapansi!
Chinese: 你好世界!
Croatian: Pozdrav svijete!
Czech: Ahoj světe!
Danish: Hej Verden!
Dutch: Hallo Wereld!
English: Hello World!
Estonian: Tere maailm!
Finnish: Hei maailma!
French: Bonjour monde!
Frisian: Hallo wrâld!
Georgian: გამარჯობა მსოფლიო!
German: Hallo Welt!
Greek: Γειά σου Κόσμε!
Hausa: Sannu Duniya!
Hebrew: שלום עולם!
Hindi: नमस्ते दुनिया!
Hungarian: Helló Világ!
Icelandic: Halló heimur!
Igbo: Ndewo Ụwa!
Indonesian: Halo Dunia!
Italian: Ciao mondo!
Japanese: こんにちは世界!
Kazakh: Сәлем Әлем!
Khmer: សួស្តី​ពិភពលោក!
Kyrgyz: Салам дүйнө!
Lao: ສະ​ບາຍ​ດີ​ຊາວ​ໂລກ!
Latvian: Sveika pasaule!
Lithuanian: Labas pasauli!
Luxemburgish: Moien Welt!
Macedonian: Здраво свету!
Malay: Hai dunia!
Malayalam: ഹലോ വേൾഡ്!
Mongolian: Сайн уу дэлхий!
Myanmar: မင်္ဂလာပါကမ္ဘာလောက!
Nepali: नमस्कार संसार!
Norwegian: Hei Verden!
Pashto: سلام نړی!
Persian: سلام دنیا!
Polish: Witaj świecie!
Portuguese: Olá Mundo!
Punjabi: ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ!
Romanian: Salut Lume!
Russian: Привет мир!
Scots Gaelic: Hàlo a Shaoghail!
Serbian: Здраво Свете!
Sesotho: Lefatše Lumela!
Sinhala: හෙලෝ වර්ල්ඩ්!
Slovenian: Pozdravljen svet!
Spanish: ¡Hola Mundo!
Sundanese: Halo Dunya!
Swahili: Salamu Dunia!
Swedish: Hej världen!
Tajik: Салом Ҷаҳон!
Thai: สวัสดีชาวโลก!
Turkish: Selam Dünya!
Ukrainian: Привіт Світ!
Uzbek: Salom Dunyo!
Vietnamese: Chào thế giới!
Welsh: Helo Byd!
Xhosa: Molo Lizwe!
Yiddish: העלא וועלט!
Yoruba: Mo ki O Ile Aiye!
Zulu: Sawubona Mhlaba!
Steven Penny suggested to use PowerShell and do not change code page. Following picture demonstrates that the issue persists.
Windows Terminal installer (which is not a part of Windows distribution) solves utf8 output issue, please see included screen capture.
The problem is, you are using a some methods and tools that are really old. First:
Native codepage: 437
Switched codepage: 65001
You don't need to mess with the codepage any more, just leave it as the default. Also, from you picture I see you are also using Console Host, which is also really old. Windows Terminal [1] has been available since 2019, and has built in UTF-8 support. Using Windows Terminal, I can run your script, even without specifying UTF-8:
fname = 'hello_world.dat'
File.open(fname,'r') do |f|
puts f.read
end
and I get perfect result:
To use Windows Terminal, download the msixbundle file [2], then install it. Or, as it's essentially just a Zip file, you can rename it to file.zip and extract it with Windows, then run WindowsTerminal.exe. Or, since you are really having trouble with this process, you can use a portable version I just created
[3] (at your own risk).
https://github.com/microsoft/terminal
https://github.com/microsoft/terminal/releases/tag/v1.8.1444.0
https://github.com/microsoft/terminal/files/6563899/CascadiaPackage_1.8.1444.0_x64.zip

Behavior of "?" is fishy when trying to rename all the files of current folder(thro' Batch Script) expecting that extension would be unchanged

I have been scripting in Windows(7 64Bit) Batch engine for sometime now.
What I find really disappointing is the rename command when trying to rename all files in a folder and using "?" to keep the file extension unaltered.
Please look at the below set of commands:
#echo off
set /p filename="Desired File Name: "
rename *.* "%filename%.???"
This is supposed to keep the file extension as it is but, on the contrary, if I pass the filename as "MONEY 2016" it unexpectedly renames the files to "MONEY 2016.201", why is that ?
Also, as debugging step, I printed the filename right after getting it inputted from the user, it prints as it is with spaces, so it doesn't seem like space issue at all..
How to make this work as expected with a one-liner as short as possible ?
Here's my comment as an answer.
I'd suggest a For loop as a simple method of performing this task:
#Set /P "filename=Desired File Name: "
#For %%A In (*.*)Do #If Not Exist "%filename%%%~xA" Ren "%%A" "%filename%%%~xA" 2>Nul
Please note that this method does not perform any verification of the user input. They could enter nothing, or they may enter a filename which is invalid. I'll leave it to you to implement a verification process, should you feel it necessary.
You are changing the structure of original and new names. * certainly does not match ??? (this should be obvious). A rename command with the proper structure works well:
C:\Users\Antonio\Tests> dir
El volumen de la unidad C no tiene etiqueta.
El número de serie del volumen es: 0895-160E
Directorio de C:\Users\Antonio\Tests
28/03/2019 10:12 p. m. <DIR> .
28/03/2019 10:12 p. m. <DIR> ..
28/03/2019 10:11 p. m. 7 four.srt
28/03/2019 10:11 p. m. 7 one.mkv
28/03/2019 10:11 p. m. 7 three.avi
28/03/2019 10:11 p. m. 7 two.mp4
4 archivos 28 bytes
2 dirs 391,521,251,328 bytes libres
C:\Users\Antonio\Tests> rename *.* NewName.*
C:\Users\Antonio\Tests> dir
El volumen de la unidad C no tiene etiqueta.
El número de serie del volumen es: 0895-160E
Directorio de C:\Users\Antonio\Tests
28/03/2019 10:12 p. m. <DIR> .
28/03/2019 10:12 p. m. <DIR> ..
28/03/2019 10:11 p. m. 7 NewName.avi
28/03/2019 10:11 p. m. 7 NewName.mkv
28/03/2019 10:11 p. m. 7 NewName.mp4
28/03/2019 10:11 p. m. 7 NewName.srt
4 archivos 28 bytes
2 dirs 391,521,251,328 bytes libres

Block Windows Shutdown with Batch

I wanted to ask if it was possible to block or lengthen the windows shutdown process after starting it through a batch file.
This is my code:
#echo off
start shutdown.exe -s -t 1800
Thanks and excuse me for my bad english but I'm italian :)
Think shutdown /a will do what you ask.
I suggest you to read the man of the commend: just type it in a console and see what option is good for you.
Then to 'delay' the shutdown you can use the /t parameter and set a personalized delay (30" is default)
IT:
Prova con il comando scritto sopra, inoltre ti consiglio di leggere la descrizione di shutdown in cui ti spiega tutte le opzioni: apri un terminale e digiti 'shutdown' per avere la lista dei possibili argomenti. il parametro /t ti consente di specificare un ritardo alla chiamata di shutdown.

Invalid key name

In a quick and dirty backup script that's been running fine for years, the registry backup part no longer works. I run the offending code in the command line and get the same result:
C:\>reg export /y HKLM\SOFTWARE\ODBC\ODBC.INI test.reg
ERROR: nombre de clave no válido.
Escriba "REG EXPORT /?" para obtener detalles de uso.
Error translates as "invalid key name". If I lauch regedit and copy the key name to clipboard I get this:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
If there is a typo, I'm unable to spot it.
Am I really mistyping the key name? Is there any other reason for the error?
Documentation says this:
Reg export KeyName FileName [/y]
In other words, flags come last:
C:\>reg export HKLM\SOFTWARE\ODBC\ODBC.INI test.reg /y
La operación se ha completado correctamente.
No idea why it's been working before.

Resources