Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Batch File - Pause Execution and View Variable Values?
Message
De
10/10/2007 12:57:10
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
Information générale
Forum:
Windows
Catégorie:
Informatique en général
Divers
Thread ID:
01260069
Message ID:
01260088
Vues:
19
Tried that and still get the error. If I comment out and change references for the sc.exe, then it works. Must be syntax. Here is the block of code that works, but still shows code that didn't work. Do you see anything obvious?

UPDATE: By testing I found out that the values of the parameters are valid and that it doesn't matter which ones I send, there can even be three, but I think the problem is that the three of them together are too long for the command. They include paths, which is required, so how do I send these paramenters to the batch file?

UPDATE2: Ok, I tried sending 50 characters each for the 3 parameters and it accepted them, so it's not length. Stuff like this drives me nuts. It all works great until it just doesn't.

UPDATE3: Ok, I've changed the run command to this, and I don't get an error, but it's not pausing for me to see what the values of the parameters are either. It just flashes the DOS screen and goes away.
RUN "&InstallBatchFilename"  "&scFilename" "&instsrvFilename" "&srvanyFilename"
What's below here is what I orignally posted...
	LOCAL ;
		m.CurrentSafetySetting, ;
		m.InstallBatchCommands

	m.CurrentSafetySetting =  SET('SAFETY')
	
	SET SAFETY OFF

	m.InstallBatchCommands = ''

*!*		m.InstallBatchCommands = m.InstallBatchCommands + 'echo "%~f1" "%~f2" "%~f3"' + CHR(13) + CHR(10)
*!*		m.InstallBatchCommands = m.InstallBatchCommands + 'pause' + CHR(13) + CHR(10)
*!*		m.InstallBatchCommands = m.InstallBatchCommands + '"%~f1" delete "EMPS"' + CHR(13) + CHR(10)
*!*		m.InstallBatchCommands = m.InstallBatchCommands + '"%~f2" EMPS "%~f3"' + CHR(13) + CHR(10)

	m.InstallBatchCommands = m.InstallBatchCommands + 'echo %1 %2' + CHR(13) + CHR(10)
	m.InstallBatchCommands = m.InstallBatchCommands + 'pause' + CHR(13) + CHR(10)
	m.InstallBatchCommands = m.InstallBatchCommands + '%1 EMPS %2' + CHR(13) + CHR(10)

	m.InstallBatchFilename = SYS(2023)+'\EMPS_Install.bat'
	STRTOFILE(m.InstallBatchCommands,m.InstallBatchFilename)

*	m.scFilename = SYS(2023)+[\sc.EXE]
*	STRTOFILE(FILETOSTR([sc.EXE]),m.scFilename)

	m.instsrvFilename = SYS(2023)+[\instsrv.EXE]
	STRTOFILE(FILETOSTR([instsrv.EXE]),m.instsrvFilename)

	m.srvanyFilename = SYS(2023)+[\srvany.EXE]
	STRTOFILE(FILETOSTR([srvany.EXE]),m.srvanyFilename)

*	RUN /N sc.exe create "EMPS" binPath= "c:\FMSRun\EMPS.exe"
*	RUN EMPS_Install.bat "&scFilename" "&instsrvFilename" "&srvanyFilename"
	RUN EMPS_Install.bat "&instsrvFilename" "&srvanyFilename"
>Your batch file doesn't semm right to me. Try
>echo %1 %2 %3
>pause
>"%1" delete "EMPS"
>"%2" EMPS "%3"
>
>
>
>>For extra credit (like you need any) why would I get an error that the RUN command failed because the parameter is incorrect?
>>
>>
>>RUN EMPS_Install.bat "&scFilename" "&instsrvFilename" "&srvanyFilename"
>>
>>
>>The parameters evaluate to basically "c:\MyPath\MyFile" for each one. They are valid paths/files. This worked before I added the %1 paramemeter (and renamed 1 and 2 to 2 and 3 repectively) in order to run the delete command.
>>
>>This is the batch file:
>>
>>
>>echo %~f1 %~f2 %~f3
>>pause
>>"%~f1" delete "EMPS"
>>"%~f2" EMPS "%~f3"
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform