Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 从windows中删除Openssl命令中的回车符_Batch File_Openssl_Tr - Fatal编程技术网

Batch file 从windows中删除Openssl命令中的回车符

Batch file 从windows中删除Openssl命令中的回车符,batch-file,openssl,tr,Batch File,Openssl,Tr,我想在运行OpenSSL命令时从输出文件中删除回车符 这是我的代码,由于这是UNIX命令,我得到的错误tr无法识别。但如何在Openssl命令链接中转换为批处理命令 openssl enc -aes-256-cbc -K "C:\cat aes_key.txt" -iv "C:\aes_iv.txt" -in plaintext.xml | openssl enc -e -base64 | tr -d '\n' > encrypted.txt 用repl.bat命令替换此| tr-d'\

我想在运行OpenSSL命令时从输出文件中删除回车符

这是我的代码,由于这是UNIX命令,我得到的错误tr无法识别。但如何在Openssl命令链接中转换为批处理命令

openssl enc -aes-256-cbc -K "C:\cat aes_key.txt" -iv "C:\aes_iv.txt" -in plaintext.xml | openssl enc -e -base64 | tr -d '\n' > encrypted.txt
用repl.bat命令替换此| tr-d'\n'>encrypted.txt

|repl "\r" "" xm > encrypted.txt
这假设它是一个CR,而不是一个CRLF,这是正常的Windows行结束。如果要替换CRLF,请使用\r\n

这将使用名为repl.bat的助手批处理文件-下载自:


将repl.bat与批处理文件放在同一文件夹中,或放在路径上的文件夹中。

感谢您的支持。我已经通过vbscript找到了一个解决方案。我写了下面的vbscript,并将其保存为vbs文件,并传递需要删除的文件名和路径

Const ForReading = 1 
Const ForWriting = 2 
strFileName = Wscript.Arguments(0) 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFile = objFSO.OpenTextFile(strFileName, ForReading) 
WScript.Echo "Checking"
strText = objFile.ReadAll 
objFile.Close 
strNewText = Replace(strText, chr(010), "") ' chr(010) = line feed chr(013) = carriage return 

Set objFile = objFSO.OpenTextFile(strFileName, ForWriting) 
WScript.Echo strNewText
objFile.WriteLine strNewText 
objFile.Close

也许来自的tr.exe可以帮助您?链接未打开。。你能从repl粘贴代码吗?我现在得到了代码。。你能告诉我你的命令是什么吗?它是作为变量的xml内容吗?如果在先前编写的现有shell脚本中是这样,那么他们不会传递任何变量。。那么我可以从命令中删除这个xm吗?xm是repl.bat的开关,与XML无关。运行repl/?查看帮助屏幕。