Page 1 of 1
Setvol not working from within batch filr
Posted: Sun Aug 11, 2019 5:43 pm
by Kichiji
If I run setvol from the command line, it works fine. ...For example, "setvol 25".
If I run setvol from a batch file, the word "error" appears in red, and the volume does not change.
(Windows 7, 32-bit Service Pack 1)
Re: Setvol not working from within batch filr
Posted: Sun Aug 11, 2019 6:04 pm
by RobLatour
can you please attach your .bat file
I just ran a quick test, and it works for me. To test it, I create a file called c:\temp\test.bat with the following contents:
Code: Select all
c:
cd \
cd program files
cd setvol
setvol 25
pause
Re: Setvol not working from within batch filr
Posted: Mon Aug 19, 2019 11:45 am
by Kichiji
Code: Select all
path
rem PATH=C:\Windows\system32;C:\Windows
%dstdir%\shadow\bin\setvol 27
rem above gives error
rem dstdir=d:
rem exe is fully pathed because d:\shadow\bin is not on the path.
rem exe executes but gives red "error" message.
setvol 27
rem above should not work, because setvol.exe is not on the path.
rem ...but it works! ...And gives no error. WTH? (what the hey/heck)
pause
Re: Setvol not working from within batch filr
Posted: Mon Aug 19, 2019 4:46 pm
by RobLatour
I have my version stored in c:\program files\setvol
and with that, from the cmd prompt
"c:\program files\setvol\setvol" 27
returns an error
but
"c:\program files\setvol\setvol.exe" 27
works.
So I would suggest you replace
%dstdir%\shadow\bin\setvol 27
with
%dstdir%\shadow\bin\setvol.exe 27
please let me know if the fix to your batch file above works for you.
as to why setvol 27 works, it should not, unless you have setvol also stored in a directory on your path, or your batch file has the current directory pointed to where setvol resides.
Re: Setvol not working from within batch filr
Posted: Tue Aug 20, 2019 12:28 am
by Kichiji
You are right. setvol 27 works because I am running the batch from a window that already has path set to d:\shadow\bin
If I retry the test from a fresh window, it gives the expected error...
'setvol' is not recognized as an internal or external command,
operable program or batch file.
This particular batch needs to work in any window, even those where the path has not been set, which is why I fully pathed it, as I mentioned before.
changing setvol to setvol.exe works, but it's still a puzzle.
I wrote a utility called waittill.exe, and...
d:\shadow\bin\waittill 11:18
...works fine.
So, now I can get my batch to work. Thank you. It just nags at my brain that setvol.exe works, but setvol doesn't.
Re: Setvol not working from within batch filr
Posted: Tue Aug 20, 2019 7:17 am
by RobLatour
ok - glad its working for you. Gotta love Windows!