Kris_28

Prominent
Mar 31, 2017
3
0
510
I am working on this batch file and i need some help to complete it... Here it is and what it does. First it would copy a file to a remote computer, using (pclist.txt), second it start the psexec on the remote computer and changes directory (windows/temp) folder. Fially it suppose to execute the commands "expand" and "dism" which those 2 commands i cant get to work. So everything works up to this line (for /F %%a in (pclist.txt) do psexec \\%%a\ cmd /k cd c:\windows\temp).

the next step is running the other 2 commands which i can't get to work, ive tried using the "&", but that doesn't work.

expand -f: *"Windows6.1-KB3192403-x86.msu" %TEMP%
dism /online /add-package /packagepath:c:\windows\temp\Windows6.1-KB3192403-86.cab /quiet /norestart

these 2 commands will not run, like i said the psexec runs and then changes directory to the windows/temp but nothing happens after that. Any help would be greatly appreciated. thanks all :)

----------------------------------------------------------------------------------------
@echo off
for /F "tokens=*" %%1 in (pclist.txt) do (
echo Copying files to %%1
MD "\\%%1\c$\targetfolder"
copy "c:\Users\Kris\Programs\Windows6.1-KB3192403-x86.msu"
"\\%%1\c$\windows\temp"
)
:::: End Copy ::::::

for /F %%a in (pclist.txt) do psexec \\%%a\ cmd /k cd c:\windows\temp &
type "expand -f: *"Windows6.1-KB3192403-x86.msu" %TEMP% &
do dism /online /add-package
/packagepath:c:\windows\temp\Windows6.1-KB3192403-86.cab /quiet /norestart
& pause
-----------------------------------------------------------------------------------------
 

Kris_28

Prominent
Mar 31, 2017
3
0
510



it's not giving any errors, and it wont do anything after it psexec to windows/temp on the remote computer, the cursor just sits there blinking, as if it doesn't know what to do next, so these two commands are not running...

"expand -f: *"Windows6.1-KB3192403-x86.msu" %TEMP%
dism /online /add-package /packagepath:c:\windows\temp\Windows6.1-KB3192403-86.cab /quiet /norestart

getting the FOR command to run these 2 commands is not working, like i said it changes directory on the remote computer to c:\windows\temp, which is where the file that was copied is being stored, but the "&" is not working , which should be telling it to run the next command???
 

Kris_28

Prominent
Mar 31, 2017
3
0
510


I was trying different options, "type" , "do" etc... but none was working

Also i've looked at that link, and it seems to be the same issue i'm having, ive also tried the () and that did not work. once again it just sits there...