Can I access environment variable inside a file - cmd

Here I'm setting the values in cmd.
cmd> set tb_name="student";
How to access it in a file in same window? Because I will run SQL file from cmd there I need to change table name,.

Related

SSIS: Cannot open datafile (path is correct)

I'm trying to generate a csv running a SSIS package.
First, I've created a string variable DATA_PATH (same name as windows system variable). Then, I've set a Process Task which run an echo to a Windows system variable like this:
The output of the command set my variable DATA_PATH correctly.
When I run the package, it throws the error "[Destino de archivo plano 1 [44]] Error: Cannot open the datafile (...)". But, if I hardcode my SSIS variable with the same exact file path as the echo %DATA_PATH% output, the package run correctly, without any error.

SQLPLUS login | run script

I want oracle/sqlplus to run a sql script as soon as I login or connect to a database. How can I achieve that?
In that script I want to set few formatting commands like pagesize, column format etc.
You can configure a user-specific script that is executed each time you start SQL*Plus
SQL*Plus looks for that user profile script in the directories specified in the SQLPATH environment variable or the equivalent registry entry in Windows

open files by command prompt which are in system PATH variable

My system PATH variable contains "C:\myfiles" and I have a file "C:\myfiles\abc.txt".
Now I want to open it by notepad via command prompt using just "notepad abc.txt"
I expect it to open "C:\myfiles\abc.txt" (just like Bash), but it opens a file from my home directory.
How to make command prompt to search for files in PATH variables first?
in a computer property>>advanced system setting >> system property >> envirmental veriables>> then select system variables path>> click on edit system variables path >> add new<C:\myfiles> or edit append in last <;C:\myfiles>
now just type in run box or cmd prompt>> abc.txt

Setting environment variables via Command Prompt from file

Aside from setting N environment variables using these steps:
Open System Properties
Click Advanced system settings
Click Environment Variables
Create/Update/Delete Environment Variables
Is there a way to set multiple environment variables on a text file and load it on command prompt? The file would look like this:
SET <VariableName>=<PATH>
SET <VariableName>=<PATH>
SET <VariableName>=<PATH>
SET <VariableName>=<PATH>
SET <VariableName>=<PATH>
If so, what command should I run if the file would be saved as EnvironmentVariables.txt

How to source sql file in windows for Oracle DB

I want to source a sql file located in "C:\Users\Administrator\Desktop\malintha.sql" location. I used following command in sql plus
SQL> #C:\Users\Administrator\Desktop\malintha.sql
But it gives me
Unable to open file error.
How to do this correctly ?
You are doing it correctly but the file either isn't there or you have no permissions.
Double check the path
Ensure you are running the SQLPlus session in a command window with appropriate privs (perhaps Run As Administrator)
Try executing from a regular user directory instead of Administrator
I just tested a SQL file with:
SQL> #C:\users\msmith\desktop\test.sql

Resources