I am trying to create a script which will copy random files to a specific local/ network folder.
These files should be copied using a domain username and password.
I have created a script however it is giving me error "1783: The stub received bad data"
Below is the script.
----------------
Code: Select all
@echo off
setlocal EnableDelayedExpansion
cd "C:\Random Files\"
set dr=%cd%
set n=0
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
set fl1=%dr%\!file[%rand%]!
echo %fl1%
runas /env /user:contoso\Aahana.S "cmd /k copy \"%fl1%\" \\vfile1\test"
------------------
If i use below given command then i am able to create a file on the network share.
runas /env /user:contoso\Aahana.S "cmd /k copy \"C:\Randome Files\Code12a.txt\" \\vfile1\test
When i use same command in script it gives me "1783: The stub received bad data" error.
Request your help on this.