How do I accept \" as argument to dos

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
batchnewbie
Posts: 7
Joined: 08 Nov 2021 19:35

How do I accept \" as argument to dos

#1 Post by batchnewbie » 31 Mar 2022 21:30

Dear all,

not workable

Code: Select all


sqlplus sys@localhost/worcl.cambridge.com as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 1 11:19:10 2022

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

working

Code: Select all

sqlplus sys@\"localhost/worcl.cambridge.com\" as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 1 11:15:33 2022

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter password


how do I accept \"<hostname>\"/<service_name> in dos batch

currently I program the following:
inside batch_file.bat

Code: Select all

SET one=%~6

SET connection_string=%one%

sqlplus.exe %connection_string%

But the above is not enough because if i entered <batch_file>.bat "sys@\"localhost/worcl.cambridge.com as sysdba\""

it will not work as expected.

many thanks

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How do I accept \" as argument to dos

#2 Post by aGerman » 01 Apr 2022 05:38

Try to escape the surrounding quotes of the argument like:

Code: Select all

whatever.bat ^"sys@\"localhost/worcl.cambridge.com\" as sysdba^"
Steffen

Post Reply