I've beeen trying to set up a batch-script which should do the following:
First, install a exe file, preferrably quietly (of course check if it's already installed). Then traverse to where .net framework is installed. After the traverse, it should set Caspol rights and regasm. And then copy some shortcuts and a checkfile (to see if this has already been done).
Does anyone have any idea why this is not working? When I do the commands by copy & paste into my commandline, everything works, but not when the script is running.
Suggestions on what is wrong, and some improvements would be greatly appreciated.
REM Upgrade RS Framework 2.0V
@echo off
if exist "C:\CheckNet.txt" GOTO END
P:\RS\Klient\PClient.exe
cd\
cd C:\Windows\Microsoft.NET\Framework\v2.0.50727
caspol -machine -addgroup 1. -url \\Domain\Program\RS\* FullTrust -n RS -s on
regasm \\Domain\Program\RS\TE.HCW.PRS.RS.Wrapper.dll
copy \\Domain\Program\TE\RS\ClientInstallation\CheckNet.txt c:\
COPY "\\Domain\Program\shortcut\RS\*.*" "c:\Documents and settings\All Users\Desktop"
:END
My guess is you have not explicitly set the drive to 'C:'. It possible that when the script runs it's current working directory is not on the c: drive.
UPDATED: full path to call caspol and regasm
Try this:
If the script cannot find CASPOL or REGASM, then likely the path the script is running under is different than the path the command window is running under. In the command window type set path to see the paths that Windows will search looking for a file. Three ways to fix it: One) update the environment the script runs under Two) Add a set path command to the script to set the path before the CASPOL line. Three) Use the full path on the CASPOL and REGASM something like c:\directorypath\CASPOL ....