I have a cmd batch script named runcmd.bat as follows
plink.exe -ssh 1.11.1.1 -l kaka -pw babay < commands.txt >output.txt
when this batch script is called from CMD, it generates the following error:
C:\Users\ASAD\Desktop\PuTTY>runCmd.bat
C:\Users\ASAD\Desktop\PuTTY>c:
C:\Users\ASAD\Desktop\PuTTY>cd \
C:\>cd "Users\ASAD\Desktop\PuTTY"
C:\Users\ASAD\Desktop\PuTTY>plink.exe -ssh 1.11.1.1 -l kaka -pw babay 0<commands.txt 1>>output.txt
The system cannot find the file specified.
C:\Users\ASAD\Desktop\PuTTY>
The system cannot find the file specified.
If you can see, it automatically adds 0 and 1 before < and > input and output redirections operators.
I'm using Windows 8.1 x64. I have also tried this same in windows 2012 R2 Server but all ended up showing the same.
I expect that the script executes without adding any number before input and output redirector.
I am trying to build the Cache database and calling the command
echo do ##class(SYS.Database).DismountDatabase("%CACHE_DIR%\CODE") Halt EOT | %CACHE_DIR%\bin\cache.exe -s %CACHE_DIR%\mgr -U %SYS
But after that immediately displays a message:
Username:
Password:
Access Denied
How to pass parameters(username, password) to cache.exe in bat file?
I haven't found --help or something like this.
Try something like:
%CACHE_DIR%\bin\csession CACHE20172 -U %SYS "##class(SYS.Database).DismountDatabase(""%CACHE_DIR%\CODE"")"
when I execute using zenmap command, I get the error, Failed to open normal output file n for writing QUITTING!
How can I write the scan result to a file?
nmap -oN n "c:\\temp\\scan1.txt" 192.168.1.2
According to this quote from the manual:
OUTPUT:
-oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
and Grepable format, respectively, to the given filename.
It appears that the file designation should be placed immediately following the oN (ie, without the intervening n).
Make sure your directory and folder names are correct. This happens when you try to save the output file and path you gave does not exist or match.
try to first go to the directory on command line, then run the command with just name of the text like in the following;
nmap -oN scan.txt scanme.nmap.org
Just place a " - " before writing an target IP address
command:-sudo nmap -oG 192.168.18.0/24 -vv
result:-Failed to open machine output file 192.168.18.0/24 for writing
QUITTING!
after placing " - " before writing IP address
command:-sudo nmap -oG - 192.168.18.0/24 -vv
result:-# Nmap 7.91 scan initiated Wed Aug 25 15:22:58 2021 as: nmap -oG - -vv 192.168.18.0/24
#Ports scanned: TCP(1000;1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121.............................................................................................................................
When I try executing this using popen it returns this error but when I run this in terminal it works!
popen("ssh -n -f *.*.*.* 'sshfs -o nonempty *.*.*.*:/home/foo/bar/ /foo1/foo2/foo3'", "r");
error:
ssh_exchange_identification: Connection closed by remote host
I use public and private key to ssh without passwords and they work properly as this command run flawlessly in terminal.
I changed it to this :
popen("ssh -n -f *.*.*.* `sshfs -o nonempty *.*.*.*:/home/foo/bar/ /foo1/foo2/foo3`", "r");
It return errors too.
error :
fuse: bad mount point `/foo1/foo2/foo3': No such file or directory
Cannot fork into background without a command to execute.
I also tried escipping the internal "" this way : \" \" but it hangs!
Replace ssh with /usr/bin/ssh, do the same with other commands, like sshfs. Specify the full path of the command, /usr/sbin/foo or whatever the case may be. popen does not necessarily use the same shell you have at the command line to execute commands. Check your documentation.
I have a BAT file that runs a script on oracle :
sqlplus myuser/mypassword#mydatabase #C:\runthisfile.sql
I want to distribute this to other users (that don't necessarily know how to modify a BAT file).
I want the dos prompt to ask the user to enter their user and password (obviously I don't want to give them my connection details). Have tried all types of combination but all that happens is that I end up with SQL>......
Am stumped!
You can use the SET command with the /P argument in order to prompt the user for text during a batch file run, for example:
SET /P variable=Please enter text
This will then fill variable with whatever they type before hitting return.
#ECHO OFF
SET /P uname=Username:
SET /P pass=password:
This is a simple program which will prompt the first for a username, then a password.
You should then be able to pass this as an argument to sqlplus:
sqlplus %uname%/%pass%#mydatabase #C:\runthisfile.sql
Regarding with SQLPlus stop, doing nothing:
Sometimes SQLPlus finish with ... meaning that is waiting for something more.
Try to add "/" (without quotes) in the end of your SQL file to execute it.
I hope it will help...
It is the very simple code for opening SQLPLUS without entering usename and password manually.
sqlplus -L UserName/Password
For example : sqlplus -L Rak4ak#sun64/rk4
For Understanding :
sqlplus [ [] [{logon | /nolog}] [] ]
is: [-C ] [-L] [-M ""] [-NOLOGINTIME] [-R ]
[-S]
-C <version> Sets the compatibility of affected commands to the
version specified by <version>. The version has
the form "x.y[.z]". For example, -C 10.2.0
-L Attempts to log on just once, instead of
reprompting on error.
-M "<options>" Sets automatic HTML markup of output. The options
have the form:
HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
[ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
-NOLOGINTIME Don't display Last Successful Login Time.
-R <level> Sets restricted mode to disable SQL*Plus commands
that interact with the file system. The level can
be 1, 2 or 3. The most restrictive is -R 3 which
disables all user commands interacting with the
file system.
-S Sets silent mode which suppresses the display of
the SQL*Plus banner, prompts, and echoing of
commands.
is: {[/][#] | / }
[AS {SYSDBA | SYSOPER | SYSASM | SYSBACKUP | SYSDG | SYSKM}] [EDITION=value]
Specifies the database account username, password and connect
identifier for the database connection. Without a connect
identifier, SQL*Plus connects to the default database.
The AS SYSDBA, AS SYSOPER, AS SYSASM, AS SYSBACKUP, AS SYSDG,
and AS SYSKM options are database administration privileges.