USGLOBAL
asked on
Converting simple batch file to PowerShell
I need this batch file process as a PowerShell script... Please..
The ftp.in file is the information to log into the FTP server to download the files.
echo ftp download...
echo off
cls
erase somefile1.
erase somefile1.z
erase somefile2.
erase somefile2.z
ftp -s:\testfolder\ftp.in
gzip -d somefile1
gzip -d somefile2
4print -1 -u -fn -s -loren -mf -olpt2: C:\testfolder\somefile2
Copy C:\DDC\somefile2 somefile2.txt
The ftp.in file is the information to log into the FTP server to download the files.
open ftp.anyserver.com
username
password
cd ftp_in
lcd C:\testfolder
binary
prompt n
get somefile1.Z
get somefile2.Z
bye
ASKER
Thank you for your input. My goal, ultimately, is to move into the PowerShell world. I will try your suggestion sometime today.
ASKER
Here is my PS1 script:
Write-Host ftp download...
Write-Host off
cls
Remove-Item somefile1.
Remove-Item somefile1.z
Remove-Item somefile2.
Remove-Item somefile2.z
ftp -s:\testfolder\ftp.in
gzip -d somefile1
gzip -d somefile2
4print -1 -u -fn -s -loren -mf -olpt1: C:\testfolder\ugsu1005
Copy-Item C:\testfolder\somefile2 somefile2.txt
And it returned this error:Bad numeric constant: 4.
At C:\testfolder\test.ps1:12 char:2
+ 4 <<<< print -1 -u -fn -s -loren -mf -olpt1: C:\testfolder\somefile2
+ CategoryInfo : ParserError: (4:String) [], ParseException
+ FullyQualifiedErrorId : BadNumericConstant
4PRINT is a DOS application that is in the path statement on the server the script is run on.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
As always Qlemo has provided a correct solution to my problem!!
Is there some specific PowerShell functionality that you want to implement or are you simply wanting to move into the PowerShell world?