SQLCMD to connect to Linked server I'm getting a login error with the below sqlcmd to connect to a linked server:

SQLCMD -E -dlinkedserver -ig:\temp\script.sql -o g:\temp\test.txt


My linked server which is an oracle connects through the app account from the linked server.

Is there anything wrong with the above code, it tried to login to the linked server, run a scripts, and log to a file.
If you want to use the linked server defined in a SQL Server instance, then you need to connect to the SQL Server instance that hosts the linked server, and make sure that your commands reference the linked server objects using 4-part naming. The SQLCMD program has no idea what a linked server is, so it can't connect to a linked server directly. 

Let's say your linked server is named MyLinkedServer then your .sql file should look something like this:

INSERT SQLServerDatabase.dbo.TableName(columns) -- SQL Server table
  SELECT columns FROM MyLinkedServer..[Schema].[TableName]; -- Oracle table


Or:

INSERT SQLServerDatabase.dbo.TableName(columns) -- SQL Server table
  SELECT columns FROM OPENQUERY
  (
    MyLinkedServer, 
    N'SELECT columns FROM [Schema].[TableName]' -- Oracle table
  );


And your SQLCMD would not say anything about the linked server name at all, because it gets information about the linked server from inside the script:

SQLCMD -E -S Server\Instance -i g:\...\file.sql -o g:\...\log.txt


Of course there are other ways to run queries against Oracle if you don't need to rely on (a) SQLCMD or (b) the linked server defined in the SQL Server instance.