Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to convert batch script to PS1 (Powershell)?

Asked by 10 years ago

I need to convert the below batch file to PS1.. does anybody able to help me on this..?

SET server=\XAEO001.COM. SET importShare=\mcefl03.COM.\onguard

:BEGIN IF NOT EXIST %importshare%\prod\data\in\ATL01_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL01_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL02_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL02_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL03_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL03_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL04_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL04_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL05_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL05_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL06_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\ATL06_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\CHL01_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\CHL01_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\CHL02_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\CHL02_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL10_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL10_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL22_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL22_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL44_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL44_OpenItems.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL48_Debitor.csv GOTO EINDE IF NOT EXIST %importshare%\prod\data\in\DEL48_OpenItems.csv GOTO EINDE

RCMD %Server% XCOPY D:\Data\Onguard\Bestanden\GSA*.* D:\Data\Onguard\Bestanden\GSA\History /c /h /r /y ATTRIB -r %Server%\D$\Data\Onguard\Bestanden\GSA*.* RCMD %Server% DEL /F D:\data\onguard\bestanden\GSA*Debitor.csv RCMD %Server% DEL /F D:\data\onguard\bestanden\GSA*OpenItems.csv

:: Benodigde databestanden kopieren naar doel lokatie en verwijderen uit de bron.

XCOPY /C /H /R /Y %importshare%\prod\data\in*Debitor.csv %Server%\D$\Data\Onguard\Bestanden\GSA\ XCOPY /C /H /R /Y %importshare%\prod\data\in*OpenItems.csv %Server%\D$\Data\Onguard\Bestanden\GSA\ ECHO Y|DEL %importshare%\prod\data\in*Debitor.* ECHO Y|DEL %importshare%\prod\data\in*OpenItems.*

RCMD %Server% XCOPY /C /H /R /Y D:\Data\Onguard\Debite~1\GSA*.* D:\Data\Onguard\Debite~1\GSA\History ECHO Y|DEL %server%\D$\data\onguard\Debite~1\GSA*.* RCMD %Server% XCOPY /C /H /R /Y D:\Data\Onguard\Factuu~1\GSA*.* D:\Data\Onguard\Factuu~1\GSA\History ECHO Y|DEL %server%\D$\data\onguard\Factuu~1\GSA*.* RCMD %Server% XCOPY /C /H /R /Y D:\Data\Onguard\Import\log\GSA*.* D:\Data\Onguard\Import\log\GSA\History ECHO Y|DEL %server%\D$\data\onguard\import\log\GSA*.*

soon %server% 60 /INTERACTIVE D:\apps\OnGuard\Preprocessor.exe -a=NL server=pdb11v.com\inst1 db=OnGuard trusted=no

:: Delete [open-posten] and [debiteuren] XML files of EYNL :: ECHO Y|DEL %server%\D$\data\onguard\Debite~1\EY*.XML :: ECHO Y|DEL %server%\D$\data\onguard\Factuu~1\EY*.XML :: ECHO Y|DEL %server%\D$\data\onguard\Debite~1\HvG*.XML :: ECHO Y|DEL %server%\D$\data\onguard\Factuu~1\HvG*.XML

soon %server% 500 /INTERACTIVE D:\apps\OnGuard\CmdImport.exe server=pdb11v.com\inst1 db=OnGuard trusted=no admin=5 wait 1500 RCMD %Server% XCOPY /C /H /R /Y C:\windows\system32\Impaddressen.log D:\Data\Onguard\Import\log ECHO Y|DEL %server%\C$\windows\system32\ImpAddressen.log GOTO EINDE

:EINDE

0
Er this is a Lua site VariadicFunction 335 — 10y
0
I recommend using an all purpose scripting forum like: http://stackoverflow.com/ BosswalrusTheCoder 88 — 9y

Answer this question