I have the below code which starts the siebel tools from a batch script:
#ECHO OFF
D:
CD D:\Siebel\8.1.1.16.0\Tools\BIN\
ECHO Starting Siebel Tools
siebdev.exe /c D:\Siebel\8.1.1.16.0\Tools\CFG\tools.cfg /d DataSrc /u ADMIN /p PASSWORD
cmd
But this does not close the command prompt. Please help.
this alone should be fine, without cmd in the end line
#ECHO OFF
CD /d D:\Siebel\8.1.1.16.0\Tools\BIN\
ECHO Starting Siebel Tools
siebdev.exe /c D:\Siebel\8.1.1.16.0\Tools\CFG\tools.cfg /d DataSrc /u ADMIN /p PASSWORD
just to add,
/d can be used after cd instead of D: and then using cd
Related
I am trying to execute remote batch file. I could invoke the batch file using PsExec but unable to complete due to :choice in the batch file.
Here is the snippet from batch file
:choice
set /P c=Are you sure you want to continue [Y/N]?
if /I "%c%" EQU "Y" goto :execute_script
if /I "%c%" EQU "N" goto :END
goto :choice
which populating question
I want to handle this question from the command which is like :
cmd /c start C:\temp\PSEXEC\PsExec.exe \\server -u username -p password cmd /c (^cd C:\BatchExecutors ^& SnapExecutor.bat location^)
Suggestions appreciated. Thanks in Advance.
You can use a strange CMD behaviour when 2 batch files have the same label, to bypass the question. But any code prior to the question would be ignored.
To do this, create another batch file with this inside:
call :execute_script
goto:eof
:execute_script
cd /D C:\BatchExecutors
SnapExecutor.bat %*
So what happens here is that this script will call SnapExecutor.bat, but instead of starting from the begining of the script, it will start from :execute_script
The problem now is how to execute this remotely. You might be able to create this script in a remote writable folder using this command:
cmd /c start C:\temp\PSEXEC\PsExec.exe \\server -u username -p password cmd /c "cd /D c:\[temp folder] &echo call :execute_script>temp.bat &echo goto:eof>>temp.bat &echo :execute_script>>temp.bat &echo cd /D C:\BatchExecutors>>temp.bat &echo SnapExecutor.bat %%*>>temp.bat"
(This will create the batch file, then you use this to call it:
cmd /c start C:\temp\PSEXEC\PsExec.exe \\server -u username -p password cmd /c "C:\[temp folder]\temp.bat"
NOTE:
Change [temp folder] to a writeable folder on the remote PC.
How to make this bat script run as admin either on the local computer as a scheduled task or startup up scrip?
forfiles -p "C:\ProgramData\ESET\ESET Endpoint Antivirus\Logs\eScan" -s -m *.dat /D -0 /C "cmd /c del #path"
If you are just running this once, and not automating a number of scripts, you can just hold shift and right click to run as admin.
I'm trying to write a simple batch file to initialize some tools I need on windows startup.
This is what I've at the moment:
#echo off
start /d "C:\Program Files\Sublime Text 3" sublime_text.exe
start cmd.exe /k cd /d "D:xampp/htdocs/webshop"
What I'd like to do is to execute the command compass watch once the directory has changed.
I tried start cmd.exe /k cd /d "D:xampp/htdocs/webshop" /k "compass watch" but it refers to the cd command then and thus throws me an error message (The system cannot find the path specified).
Any suggestions?
EDIT
To clarify what I need:
Open console
cd to the relevant directory
Execute the command compass watch (in that directory)
I normally do this by manually typing in the commands into the console as listed above. What I'd like to have is a simple .bat file that does exactly that with just one click.
You state in the comments that you don't need a separate interpreter. In which case I believe you can do it like this:
#echo off
start /d "C:\Program Files\Sublime Text 3" sublime_text.exe
start /d D:\xampp\htdocs\webshop compass watch
This an example to open Firefox.exe.So you should do like this, for your programs
#echo off
echo Try to open Firefox ....
CD /D %programfiles%\Mozilla Firefox\ & Start Firefox.exe
Pause
Try This :
#echo off
CD /D %programfiles%\Sublime Text 3 & Start sublime_text.exe
CD /D D:\xampp/htdocs/webshop & Start compass watch
Pause
You have to use Backslash in your path "\".
Did you try :
#echo off
"C:\Program Files\Sublime Text 3\sublime_text.exe"
cd /d "D:\xampp\htdocs\webshop"
"D:\xampp\htdocs\webshop\compass watch.exe"
This should work to launch the exe, and change folder, then use cmd /k to execute the compass command and leave the console open.
#echo off
start "" /d "C:\Program Files\Sublime Text 3" sublime_text.exe
cd /d "D:xampp/htdocs/webshop"
cmd.exe /k "compass watch"
I have this command that i need to run
cd /d C:\leads\ssh & C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby192\bin\setrbvars.bat
this opens the command prompt
but I need to run this command in the prompt
ruby C:\lead\leads.rb
which will fire off a script.....but i have no idea what to add to my bat file to do this
i tried the -f flag to tell it to run the command but no go....any ideas to what to do to make this run
cd /d C:\leads\ssh & C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby192\bin\setrbvars.bat -f ruby C:\lead\leads.rb
pause
Try the following batch file:
#echo off
cd /d C:\leads\ssh
call C:\Ruby192\bin\setrbvars.bat
ruby C:\lead\leads.rb
I currently have a command that I thought did this:
START /WAIT cmd.exe /d tester test.cmd
Although it does not appear to work, it only changes the directory, not executing test.cmd
Try with:
start /wait /d tester cmd.exe "/c test.cmd"
Or simply:
start /wait /d tester test.cmd