I am working on creating a backup program using python and batch scripts. The entire program will work if I don't have the program export a copy of the incremental backup to a shared network folder(I want to have redundancy so I have it save to server and two other terminals). I can manually go into cmd prompt and type out the ren cmd and it will do it without any issue. The problem arises when I attempt to use a variable with the ren cmd.
Example of set /p
REM Load text file with first variable
set loadDD002=C:\Backup\Bin\DD002.txt
SET /p back1Directory=<%LoadDD002%
REM Show the Defined Variable
echo back1Directory
Example of contents of DD002.txt
//SERVER/NetShare
example of cleanup/renaming
del "%back2Directory%\backup7.zip"
ren "%back2Directory%\backup6.zip" backup7.bak
ren "%back2Directory%\backup5.zip" backup6.zip
ren "%back2Directory%\backup4.zip" backup5.zip
ren "%back2Directory%\backup3.zip" backup4.zip
ren "%back2Directory%\backup1.zip" backup2.zip
ren "%back2Directory%\backup.zip" backup1.zip
Error receiving
The syntax of the command is incorrect
I apologize for any editing faux pas as I am very new to this site.
Thank you,
Nvm.. I figured it out. See below:
set "network1=%back1Directory:* =%
Then
set "network1=%back1Directory:* =%
WOOO
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.